| | |
| | | import com.zy.asrs.entity.MatCode; |
| | | import com.zy.asrs.entity.WaitPakin; |
| | | import com.zy.asrs.service.MatCodeService; |
| | | import com.zy.asrs.service.OutStockMainService; |
| | | import com.zy.asrs.service.OutStockService; |
| | | import com.zy.asrs.service.WaitPakinService; |
| | | import com.zy.asrs.utils.VersionUtils; |
| | | import com.zy.common.service.erp.ErpService; |
| | | import com.zy.common.service.erp.dto.InStockDto; |
| | | import com.zy.common.service.erp.entity.CPICMO; |
| | | import com.zy.common.service.erp.entity.InStockBillEntry; |
| | | import com.zy.common.service.erp.entity.M_item; |
| | | import com.zy.common.service.erp.entity.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | |
| | | private MatCodeService matCodeService; |
| | | @Autowired |
| | | private WaitPakinService waitPakinService; |
| | | @Autowired |
| | | private OutStockMainService outStockMainService; |
| | | @Autowired |
| | | private OutStockService outStockService; |
| | | |
| | | private Map<Integer, M_item> itemMap = new HashMap<>(); |
| | | |
| | | /** |
| | | * 原材料 |
| | | */ |
| | | // @Scheduled(cron = "0/3 * * * * ? ") |
| | | @Scheduled(cron = "0/5 * * * * ? ") |
| | | // @PostConstruct |
| | | public void inStockExecute(){ |
| | | // List<M_item> item = erpService.getItem(); |
| | |
| | | /** |
| | | * 成品 |
| | | */ |
| | | // @Scheduled(cron = "0/3 * * * * ? ") |
| | | @Scheduled(cron = "0/5 * * * * ? ") |
| | | // @PostConstruct |
| | | public void inCPICMOExecute(){ |
| | | // List<M_item> item = erpService.getItem(); |
| | |
| | | } |
| | | } |
| | | |
| | | // @Scheduled(cron = "0/3 * * * * ? ") |
| | | @Scheduled(cron = "0/5 * * * * ? ") |
| | | public void syncMat(){ |
| | | List<M_item> items = erpService.getItem(); |
| | | for (M_item item : items) { |
| | |
| | | VersionUtils.setMatCode(matCode, item); |
| | | matCode.setAppeTime(new Date()); |
| | | matCode.setModiTime(new Date()); |
| | | matCodeService.insert(matCode); |
| | | boolean insert = matCodeService.insert(matCode); |
| | | if (insert) { |
| | | log.info("=====>> 新增物料成功 : {}", JSON.toJSONString(item)); |
| | | } else { |
| | | log.error("=====>> 新增物料失败!!! : {}", JSON.toJSONString(item)); |
| | | } |
| | | } else { |
| | | VersionUtils.setMatCode(matCode, item); |
| | | matCode.setModiTime(new Date()); |
| | | matCodeService.updateById(matCode); |
| | | boolean b = matCodeService.updateById(matCode); |
| | | if (b) { |
| | | log.info("=====>> 更新物料成功 : {}", JSON.toJSONString(item)); |
| | | } else { |
| | | log.error("=====>> 更新物料失败!!! : {}", JSON.toJSONString(item)); |
| | | } |
| | | } |
| | | // 更新完之后删除 |
| | | erpService.deleteItem(item.getMnumber()); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 成品出库-发货通知单表头 |
| | | */ |
| | | @Scheduled(cron = "0/15 * * * * ? ") |
| | | public void syncOutStock(){ |
| | | List<OutStockBill> result = erpService.syncOutStock(); |
| | | for (Integer i = 0; i < result.size(); i++) { |
| | | OutStockBill main = outStockMainService.selectOne(new EntityWrapper<OutStockBill>().eq("FBrNo", result.get(i).getFBrNo()).and().eq("FInterID", result.get(i).getFInterID())); |
| | | if (null == main) { |
| | | if (!outStockMainService.insert(result.get(i))) { |
| | | log.info("出库通知主表OutStockBill同步失败"); |
| | | }; |
| | | } else { |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 成品出库-发货通知单表体 |
| | | */ |
| | | @Scheduled(cron = "0/15 * * * * ? ") |
| | | public void syncOutStockDetail(){ |
| | | List<OutStockBillEntry> result = erpService.syncOutStockDetail(); |
| | | for (Integer i = 0; i < result.size(); i++) { |
| | | OutStockBillEntry main = outStockService.selectOne(new EntityWrapper<OutStockBillEntry>().eq("FInterID", result.get(i).getFInterID()).and().eq("FEntryID", result.get(i).getFEntryID())); |
| | | if (null == main) { |
| | | if (!outStockService.insert(result.get(i))) { |
| | | log.info("出库通知明细表OutStockBillEntry同步失败"); |
| | | }; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 原材料出库 |
| | | */ |
| | | // @Scheduled(cron = "0/3 * * * * ? ") |