|  |  | 
 |  |  | import com.zy.asrs.entity.param.InitPakoutParam; | 
 |  |  | import com.zy.asrs.entity.param.MatnrDto; | 
 |  |  | import com.zy.asrs.entity.param.PakinParam; | 
 |  |  | import com.zy.asrs.entity.result.Pakin; | 
 |  |  | import com.zy.asrs.mapper.NodeMapper; | 
 |  |  | import com.zy.asrs.service.ManLocDetlService; | 
 |  |  | import com.zy.asrs.service.MatService; | 
 |  |  | import com.zy.asrs.service.NodeService; | 
 |  |  | import com.zy.asrs.utils.SaasUtils; | 
 |  |  | import com.zy.asrs.utils.VersionUtils; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.stereotype.Service; | 
 |  |  | import org.springframework.transaction.annotation.Transactional; | 
 |  |  |  | 
 |  |  | import java.beans.Transient; | 
 |  |  | import java.util.Date; | 
 |  |  | import java.util.List; | 
 |  |  |  | 
 |  |  | 
 |  |  |     private SnowflakeIdWorker snowflakeIdWorker; | 
 |  |  |     @Autowired | 
 |  |  |     private ManLocDetlService manLocDetlService; | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     public Node getTop() { | 
 |  |  |         Node top = this.selectOne(new EntityWrapper<Node>().eq("type", 0).eq("level", 0)); | 
 |  |  | 
 |  |  |                 manLocDetl.setCreateTime(now); | 
 |  |  |                 manLocDetl.setModiTime(now); | 
 |  |  |                 manLocDetl.setCreateBy(userId); | 
 |  |  |                 SaasUtils.insertLog(0,manLocDetl.getLocNo(),manLocDetl.getMatnr(), manLocDetl.getAnfme()); | 
 |  |  |                 SaasUtils.insertLog(0, manLocDetl.getLocNo(), manLocDetl.getMatnr(), manLocDetl.getAnfme()); | 
 |  |  |                 manLocDetlService.insert(manLocDetl); | 
 |  |  |             }else { | 
 |  |  |             } else { | 
 |  |  |                 check.setAnfme(dto.getCount() + check.getAnfme()); | 
 |  |  |                 manLocDetlService.update(check,new EntityWrapper<ManLocDetl>() | 
 |  |  |                 manLocDetlService.update(check, new EntityWrapper<ManLocDetl>() | 
 |  |  |                         .eq("loc_no", node.getUuid()) | 
 |  |  |                         .eq("matnr", dto.getMatnr())); | 
 |  |  |             } | 
 |  |  | 
 |  |  |                 Node node = nodeService.selectOne(new EntityWrapper<Node>() | 
 |  |  |                         .eq("id", param.getNodeId())); | 
 |  |  |                 if (node == null) { | 
 |  |  |                     return R.error("找不到该库位,请联系管理员:" + param.getNodeId() ); | 
 |  |  |                     return R.error("找不到该库位,请联系管理员:" + param.getNodeId()); | 
 |  |  |                 } | 
 |  |  |                 if (manLocDetl == null) { | 
 |  |  |                     return R.error("物料:"+ param.getMatnr() + " 在库位中不存在"); | 
 |  |  |                     return R.error("物料:" + param.getMatnr() + " 在库位中不存在"); | 
 |  |  |                 } | 
 |  |  |                 if (manLocDetl.getAnfme() - param.getCount() < 0) { | 
 |  |  |                     return R.error("物料:"+ param.getMatnr() + " 在库位中数量不足"); | 
 |  |  |                     return R.error("物料:" + param.getMatnr() + " 在库位中数量不足"); | 
 |  |  |                 } else if (manLocDetl.getAnfme() - param.getCount() == 0) { | 
 |  |  |                     SaasUtils.insertLog(1,manLocDetl.getLocNo(), manLocDetl.getMatnr(),param.getCount()); | 
 |  |  |                     SaasUtils.insertLog(1, manLocDetl.getLocNo(), manLocDetl.getMatnr(), param.getCount()); | 
 |  |  |                     manLocDetlService.delete(new EntityWrapper<ManLocDetl>() | 
 |  |  |                             .eq("loc_no",node.getUuid()) | 
 |  |  |                             .eq("matnr",param.getMatnr())); | 
 |  |  |                             .eq("loc_no", node.getUuid()) | 
 |  |  |                             .eq("matnr", param.getMatnr())); | 
 |  |  |                 } else { | 
 |  |  |  | 
 |  |  |                     manLocDetl.setAnfme(manLocDetl.getAnfme() - param.getCount()); | 
 |  |  |                     manLocDetlService.update(manLocDetl,new EntityWrapper<ManLocDetl>() | 
 |  |  |                             .eq("loc_no",node.getUuid()) | 
 |  |  |                             .eq("matnr",param.getMatnr())); | 
 |  |  |                     SaasUtils.insertLog(1,manLocDetl.getLocNo(), manLocDetl.getMatnr(),param.getCount()); | 
 |  |  |                     manLocDetlService.update(manLocDetl, new EntityWrapper<ManLocDetl>() | 
 |  |  |                             .eq("loc_no", node.getUuid()) | 
 |  |  |                             .eq("matnr", param.getMatnr())); | 
 |  |  |                     SaasUtils.insertLog(1, manLocDetl.getLocNo(), manLocDetl.getMatnr(), param.getCount()); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  | 
 |  |  |                 source.setLocNo(targetNode.getUuid()); | 
 |  |  |                 source.setNodeId(targetNode.getId()); | 
 |  |  |  | 
 |  |  |                 SaasUtils.insertLog(2,source.getLocNo(), source.getMatnr(), source.getAnfme()); | 
 |  |  |                 SaasUtils.insertLog(2, source.getLocNo(), source.getMatnr(), source.getAnfme()); | 
 |  |  |                 manLocDetlService.insert(source); | 
 |  |  |             }else { | 
 |  |  |             } else { | 
 |  |  |                 check.setAnfme(check.getAnfme() + source.getAnfme()); | 
 |  |  |                 manLocDetlService.update(check,new EntityWrapper<ManLocDetl>() | 
 |  |  |                 manLocDetlService.update(check, new EntityWrapper<ManLocDetl>() | 
 |  |  |                         .eq("loc_no", targetNode.getUuid()) | 
 |  |  |                         .eq("matnr", check.getMatnr())); | 
 |  |  |                 manLocDetlService.delete(new EntityWrapper<ManLocDetl>() |