|  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson.JSON; | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONArray; | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONObject; | 
|---|
|  |  |  | import com.baomidou.mybatisplus.mapper.EntityWrapper; | 
|---|
|  |  |  | import com.core.common.Cools; | 
|---|
|  |  |  | import com.core.exception.CoolException; | 
|---|
|  |  |  | import com.zy.asrs.entity.DocType; | 
|---|
|  |  |  | import com.zy.asrs.entity.Order; | 
|---|
|  |  |  | import com.zy.asrs.entity.OrderDetl; | 
|---|
|  |  |  | import com.zy.asrs.service.ApiLogService; | 
|---|
|  |  |  | import com.zy.asrs.service.OrderService; | 
|---|
|  |  |  | import com.zy.asrs.service.ReportToThirdService; | 
|---|
|  |  |  | import com.zy.asrs.entity.*; | 
|---|
|  |  |  | import com.zy.asrs.service.*; | 
|---|
|  |  |  | import com.zy.asrs.utils.MatUtils; | 
|---|
|  |  |  | import com.zy.nc.SendUtil; | 
|---|
|  |  |  | import com.zy.nc.entity.NccCgCgdhdWms; | 
|---|
|  |  |  | import com.zy.nc.entity.NccSaleDbddWms; | 
|---|
|  |  |  | import com.zy.nc.entity.NccSaleXsfhmxWms; | 
|---|
|  |  |  | import com.zy.nc.entity.NccScZkmxbWms; | 
|---|
|  |  |  | import com.zy.nc.entity.*; | 
|---|
|  |  |  | import com.zy.nc.service.NccSaleDbddWmsService; | 
|---|
|  |  |  | import com.zy.nc.service.NccSaleXsfhmxWmsService; | 
|---|
|  |  |  | import com.zy.nc.service.NccScPcdaWmsService; | 
|---|
|  |  |  | import com.zy.nc.util.NcResultMessage; | 
|---|
|  |  |  | import com.zy.nc.vo.*; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Value; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.math.BigDecimal; | 
|---|
|  |  |  | import java.util.ArrayList; | 
|---|
|  |  |  | import java.util.HashMap; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private ApiLogService apiLogService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private OrderService orderService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private WrkDetlService wrkDetlService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private InventoryCheckOrderService inventoryCheckOrderService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private InventoryCheckOrderDetlService inventoryCheckOrderDetlService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private StoreTypeService storeTypeService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private NccScPcdaWmsService nccScPcdaWmsService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private NccSaleXsfhmxWmsService nccSaleXsfhmxWmsService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private NccSaleDbddWmsService  nccSaleDbddWmsService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Value("${NYNC.ip}") | 
|---|
|  |  |  | private String nyncIp; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Value("${NYNC.saveRefWhsTrans}") | 
|---|
|  |  |  | private String saveRefWhsTrans; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Value("${NYNC.invcountAdd}") | 
|---|
|  |  |  | private String invcountAdd; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Value("${NYNC.purchasein}") | 
|---|
|  |  |  | private String purchasein; | 
|---|
|  |  |  | 
|---|
|  |  |  | Object process2 = null; | 
|---|
|  |  |  | String memo = order.getMemo(); | 
|---|
|  |  |  | String remark = ""; | 
|---|
|  |  |  | boolean success = false; | 
|---|
|  |  |  | log.info("订单开始上报:{}", JSON.toJSONString(order)); | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | switch (order.getDocType$().toString()) { | 
|---|
|  |  |  | case "销售退货": | 
|---|
|  |  |  | 
|---|
|  |  |  | if (!Cools.isEmpty(response) && response.isSuccess()) { | 
|---|
|  |  |  | log.info("销售发货response:{}", response); | 
|---|
|  |  |  | step = 10; | 
|---|
|  |  |  | success = true; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | remark = response.getMessage() + "--" + response.getErrorStack().substring(0, 100); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | if (!Cools.isEmpty(response) && response.isSuccess()) { | 
|---|
|  |  |  | log.info("销售发货response:{}", response); | 
|---|
|  |  |  | step = 10; | 
|---|
|  |  |  | success = true; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | remark = response.getMessage() + "--" + response.getErrorStack().substring(0, 100); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | if (!Cools.isEmpty(response) && response.isSuccess()) { | 
|---|
|  |  |  | log.info("转库-入库response:{}", response); | 
|---|
|  |  |  | step = 10; | 
|---|
|  |  |  | success = true; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | remark = response.getMessage() + "--" + response.getErrorStack().substring(0, 100); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case "采购到货": | 
|---|
|  |  |  | process1 = processCGDH(orderDetls); | 
|---|
|  |  |  | List<Object> cg = new ArrayList<>(); | 
|---|
|  |  |  | cg.add(process1); | 
|---|
|  |  |  | //发送请求 | 
|---|
|  |  |  | response = SendUtil.sendDataToNc(SendUtil.token, nyncIp + ":" + port, purchasein, JSONObject.toJSONString(cg)); | 
|---|
|  |  |  | if (!Cools.isEmpty(response) && response.isSuccess()) { | 
|---|
|  |  |  | log.info("采购到货response:{}", response); | 
|---|
|  |  |  | step = 10; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | remark = response.getMessage() + "--" + response.getErrorStack().substring(0, 100); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //不需要上报了 | 
|---|
|  |  |  | step = 10; | 
|---|
|  |  |  | //                    process1 = processCGDH(orderDetls); | 
|---|
|  |  |  | //                    List<Object> cg = new ArrayList<>(); | 
|---|
|  |  |  | //                    cg.add(process1); | 
|---|
|  |  |  | //                    //发送请求 | 
|---|
|  |  |  | //                    response = SendUtil.sendDataToNc(SendUtil.token, nyncIp + ":" + port, purchasein, JSONObject.toJSONString(cg)); | 
|---|
|  |  |  | //                    if (!Cools.isEmpty(response) && response.isSuccess()) { | 
|---|
|  |  |  | //                        log.info("采购到货response:{}", response); | 
|---|
|  |  |  | //                        step = 10; | 
|---|
|  |  |  | //                    } else { | 
|---|
|  |  |  | //                        remark = response.getMessage() + "--" + response.getErrorStack().substring(0, 100); | 
|---|
|  |  |  | //                    } | 
|---|
|  |  |  | break; | 
|---|
|  |  |  | case "转库-出库": | 
|---|
|  |  |  | if (step == 1) { | 
|---|
|  |  |  | process2 = processGENERALOUT2(orderDetls, memo); | 
|---|
|  |  |  | process2 = processGENERALOUT2(orderDetls, order.getOperMemb(), order.getItemId(), memo); | 
|---|
|  |  |  | List<Object> zkck2 = new ArrayList<>(); | 
|---|
|  |  |  | zkck2.add(process2); | 
|---|
|  |  |  | //发送请求 | 
|---|
|  |  |  | 
|---|
|  |  |  | if (!Cools.isEmpty(response) && response.isSuccess()) { | 
|---|
|  |  |  | log.info("转库-出库2response:{}", response); | 
|---|
|  |  |  | step = 10; | 
|---|
|  |  |  | success = true; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | remark = response.getMessage() + "--" + response.getErrorStack().substring(0, 100); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | log.info("转库-出库1response:{}", response); | 
|---|
|  |  |  | memo = response.getData().toString(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | process2 = processGENERALOUT2(orderDetls, memo); | 
|---|
|  |  |  | process2 = processGENERALOUT2(orderDetls, order.getOperMemb(), order.getItemId(), memo); | 
|---|
|  |  |  | List<Object> zkck2 = new ArrayList<>(); | 
|---|
|  |  |  | zkck2.add(process2); | 
|---|
|  |  |  | //发送请求 | 
|---|
|  |  |  | 
|---|
|  |  |  | if (!Cools.isEmpty(response) && response.isSuccess()) { | 
|---|
|  |  |  | log.info("转库-出库2response:{}", response); | 
|---|
|  |  |  | step = 10; | 
|---|
|  |  |  | success = true; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | remark = response.getMessage() + "--" + response.getErrorStack().substring(0, 100); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | if (!Cools.isEmpty(response) && response.isSuccess()) { | 
|---|
|  |  |  | log.info("集团内部调拨response:{}", response); | 
|---|
|  |  |  | step = 10; | 
|---|
|  |  |  | success = true; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | remark = response.getMessage() + "--" + response.getErrorStack().substring(0, 100); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | e.printStackTrace(); | 
|---|
|  |  |  | throw new CoolException("调用接口报错,请联系管理员"); | 
|---|
|  |  |  | } finally { | 
|---|
|  |  |  | reportApiLog(response, order.getDocType$(), nyncIp, saveRefDelivery); | 
|---|
|  |  |  | reportApiLog(order, process1, process2, response, order.getDocType$(), nyncIp, saveRefDelivery, success); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public boolean reportTkrk(WaitPakin waitPakin) { | 
|---|
|  |  |  | String matnr = waitPakin.getMatnr(); | 
|---|
|  |  |  | String batch = waitPakin.getBatch(); | 
|---|
|  |  |  | String orderNo = waitPakin.getTkFlag(); | 
|---|
|  |  |  | Double anfme = waitPakin.getAnfme(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Object process1 = null; | 
|---|
|  |  |  | NcResultMessage response1 = null; | 
|---|
|  |  |  | boolean success1 = false; | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | process1 = processTKRK(matnr, batch, orderNo, anfme, waitPakin.getCstateid()); | 
|---|
|  |  |  | //发送请求 | 
|---|
|  |  |  | response1 = SendUtil.sendDataToNc(SendUtil.token, nyncIp + ":" + port, saveRefDelivery, JSONObject.toJSONString(process1)); | 
|---|
|  |  |  | log.info("退库入库response:{}", response1); | 
|---|
|  |  |  | if (!Cools.isEmpty(response1) && response1.isSuccess()) { | 
|---|
|  |  |  | log.info("退库入库response:{}", response1); | 
|---|
|  |  |  | success1 = true; | 
|---|
|  |  |  | return true; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | e.printStackTrace(); | 
|---|
|  |  |  | process1 = e.getMessage(); | 
|---|
|  |  |  | } finally { | 
|---|
|  |  |  | reportApiLog(null, process1, process1, response1, "TKRK", nyncIp, saveRefDelivery, success1); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Object process2 = null; | 
|---|
|  |  |  | NcResultMessage response2 = null; | 
|---|
|  |  |  | boolean success2 = false; | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | process2 = processDBTK(matnr, batch, orderNo, anfme, waitPakin.getCstateidVcode()); | 
|---|
|  |  |  | //发送请求 | 
|---|
|  |  |  | response2 = SendUtil.sendDataToNc(SendUtil.token, nyncIp + ":" + port, dbdd, JSONObject.toJSONString(process2)); | 
|---|
|  |  |  | log.info("退库入库response:{}", response2); | 
|---|
|  |  |  | if (!Cools.isEmpty(response2) && response2.isSuccess()) { | 
|---|
|  |  |  | log.info("退库入库response:{}", response2); | 
|---|
|  |  |  | success2 = true; | 
|---|
|  |  |  | return true; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | e.printStackTrace(); | 
|---|
|  |  |  | process2 = e.getMessage(); | 
|---|
|  |  |  | } finally { | 
|---|
|  |  |  | reportApiLog(null, process2, process2, response2, "DBRK", nyncIp, dbdd, success2); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public boolean reportCheckOrder(List<InventoryCheckOrderDetl> checkOrderDetls) { | 
|---|
|  |  |  | ArrayList<String> orderNoList = new ArrayList<>(); | 
|---|
|  |  |  | HashMap<String, List<InventoryCheckOrderDetl>> map = new HashMap<>(); | 
|---|
|  |  |  | for (InventoryCheckOrderDetl checkOrderDetl : checkOrderDetls) { | 
|---|
|  |  |  | if (map.containsKey(checkOrderDetl.getCwarehouseid())) { | 
|---|
|  |  |  | List<InventoryCheckOrderDetl> list = map.get(checkOrderDetl.getCwarehouseid()); | 
|---|
|  |  |  | list.add(checkOrderDetl); | 
|---|
|  |  |  | map.put(checkOrderDetl.getCwarehouseid(), list); | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | List<InventoryCheckOrderDetl> list = new ArrayList<>(); | 
|---|
|  |  |  | list.add(checkOrderDetl); | 
|---|
|  |  |  | map.put(checkOrderDetl.getCwarehouseid(), list); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (!orderNoList.contains(checkOrderDetl.getOrderNo())) { | 
|---|
|  |  |  | orderNoList.add(checkOrderDetl.getOrderNo()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | boolean result = true; | 
|---|
|  |  |  | for (Map.Entry<String, List<InventoryCheckOrderDetl>> entry : map.entrySet()) { | 
|---|
|  |  |  | String cwarehouseid = entry.getKey(); | 
|---|
|  |  |  | List<InventoryCheckOrderDetl> list = entry.getValue(); | 
|---|
|  |  |  | Object process1 = processInvcount(list, cwarehouseid); | 
|---|
|  |  |  | NcResultMessage response = null; | 
|---|
|  |  |  | boolean success = false; | 
|---|
|  |  |  | try { | 
|---|
|  |  |  | //发送请求 | 
|---|
|  |  |  | response = SendUtil.sendDataToNc(SendUtil.token, nyncIp + ":" + port, invcountAdd, JSONObject.toJSONString(process1)); | 
|---|
|  |  |  | log.info("盘点单response:{}", response); | 
|---|
|  |  |  | if (!Cools.isEmpty(response) && response.isSuccess()) { | 
|---|
|  |  |  | log.info("盘点单response:{}", response); | 
|---|
|  |  |  | success = true; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | result = false; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | e.printStackTrace(); | 
|---|
|  |  |  | } finally { | 
|---|
|  |  |  | reportApiLog(null, process1, null, response, "盘点上报", nyncIp, invcountAdd, success); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (result) { | 
|---|
|  |  |  | List<InventoryCheckOrder> inventoryCheckOrders = inventoryCheckOrderService.selectList(new EntityWrapper<InventoryCheckOrder>() | 
|---|
|  |  |  | .in("order_no", orderNoList) | 
|---|
|  |  |  | .eq("status", 1) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | for (InventoryCheckOrder inventoryCheckOrder : inventoryCheckOrders) { | 
|---|
|  |  |  | inventoryCheckOrder.setStatus("2"); | 
|---|
|  |  |  | inventoryCheckOrderService.updateById(inventoryCheckOrder); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return result; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private Object processXSFH(List<OrderDetl> orderDetls, Boolean flag) { | 
|---|
|  |  |  | //组装对象数据 | 
|---|
|  |  |  | Map<String, Object> data = new HashMap<String, Object>(); | 
|---|
|  |  |  | SaleOutHeadVO saleOutHeadVO = new SaleOutHeadVO(); | 
|---|
|  |  |  | saleOutHeadVO.setPk_org("FYT"); | 
|---|
|  |  |  | saleOutHeadVO.setCwarehouseid("6101"); | 
|---|
|  |  |  | SaleOutBodyVO saleOutBodyVO = null; | 
|---|
|  |  |  | List<SaleOutBodyVO> saleOutBodyVOList = new ArrayList<>(); | 
|---|
|  |  |  | for (OrderDetl orderDetl : orderDetls) { | 
|---|
|  |  |  | if (orderDetl.getQty() <= 0) { | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | saleOutBodyVO = new SaleOutBodyVO(); | 
|---|
|  |  |  | String remark = orderDetl.getRemark(); | 
|---|
|  |  |  | if (!Cools.isEmpty(remark)) { | 
|---|
|  |  |  | NccSaleXsfhmxWms nccSaleXsfhmxWms = JSONObject.parseObject(remark, NccSaleXsfhmxWms.class); | 
|---|
|  |  |  | saleOutBodyVO.setCsourcetype("4331"); | 
|---|
|  |  |  | saleOutBodyVO.setClocationid("610101"); | 
|---|
|  |  |  | //saleOutBodyVO.setClocationid("610101"); | 
|---|
|  |  |  | saleOutBodyVO.setCsourcebillbid(nccSaleXsfhmxWms.getCdeliverybid()); | 
|---|
|  |  |  | saleOutBodyVO.setCsourcebillhid(nccSaleXsfhmxWms.getCdeliveryid()); | 
|---|
|  |  |  | saleOutHeadVO.setVdef2(nccSaleXsfhmxWms.getVdef2()); | 
|---|
|  |  |  | 
|---|
|  |  |  | saleOutHeadVO.setVdef13(nccSaleXsfhmxWms.getVdef13()); | 
|---|
|  |  |  | saleOutHeadVO.setVdef14(nccSaleXsfhmxWms.getVdef14()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | saleOutHeadVO.setCwarehouseid(orderDetl.getStandby1()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | saleOutBodyVO.setVbatchcode(orderDetl.getBatch()); | 
|---|
|  |  |  | saleOutBodyVO.setNshouldnum(flag ? -orderDetl.getAnfme() : orderDetl.getAnfme()); | 
|---|
|  |  |  | saleOutBodyVO.setNnum(orderDetl.getQty()); | 
|---|
|  |  |  | saleOutBodyVO.setNshouldnum(flag ? -orderDetl.getQty() : orderDetl.getQty()); | 
|---|
|  |  |  | saleOutBodyVO.setNnum(flag ? -orderDetl.getQty() : orderDetl.getQty()); | 
|---|
|  |  |  | saleOutBodyVO.setCstateid(orderDetl.getCstateid()); | 
|---|
|  |  |  | saleOutBodyVOList.add(saleOutBodyVO); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | data.put("SaleOutHeadVO", saleOutHeadVO); | 
|---|
|  |  |  | 
|---|
|  |  |  | return data; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private Object processTKRK(String matnr, String batch, String orderNo, Double anfme, String cstateid) { | 
|---|
|  |  |  | //        EntityWrapper<NccXsckmxTkWms> wrapper = new EntityWrapper<>(); | 
|---|
|  |  |  | //        wrapper.eq("VBATCHCODE", batch).eq("VSOURCEBILLCODE", orderNo); | 
|---|
|  |  |  | //        NccXsckmxTkWms nccXsckmxTkWms = nccXsckmxTkWmsService.selectOne(wrapper); | 
|---|
|  |  |  | //        if (null == nccXsckmxTkWms) { | 
|---|
|  |  |  | //            throw new CoolException("未找到此条码"); | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | NccSaleXsfhmxWms nccSaleXsfhmxWms = nccSaleXsfhmxWmsService.selectOne(new EntityWrapper<NccSaleXsfhmxWms>() | 
|---|
|  |  |  | .eq("VBILLCODE", orderNo) | 
|---|
|  |  |  | .eq("WLBM", matnr) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | if (null == nccSaleXsfhmxWms) { | 
|---|
|  |  |  | throw new CoolException("未找到销售单据"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //组装对象数据 | 
|---|
|  |  |  | Map<String, Object> data = new HashMap<String, Object>(); | 
|---|
|  |  |  | SaleOutHeadVO saleOutHeadVO = new SaleOutHeadVO(); | 
|---|
|  |  |  | saleOutHeadVO.setPk_org("FYT"); | 
|---|
|  |  |  | SaleOutBodyVO saleOutBodyVO = null; | 
|---|
|  |  |  | List<SaleOutBodyVO> saleOutBodyVOList = new ArrayList<>(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | saleOutBodyVO = new SaleOutBodyVO(); | 
|---|
|  |  |  | saleOutBodyVO.setCsourcetype("4331"); | 
|---|
|  |  |  | saleOutBodyVO.setCsourcebillbid(nccSaleXsfhmxWms.getCdeliverybid()); | 
|---|
|  |  |  | saleOutBodyVO.setCsourcebillhid(nccSaleXsfhmxWms.getCdeliveryid()); | 
|---|
|  |  |  | saleOutHeadVO.setCwarehouseid(nccSaleXsfhmxWms.getFhckbm()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | saleOutBodyVO.setVbatchcode(batch); | 
|---|
|  |  |  | saleOutBodyVO.setNnum(anfme * -1); | 
|---|
|  |  |  | saleOutBodyVO.setCstateid(cstateid); | 
|---|
|  |  |  | saleOutBodyVOList.add(saleOutBodyVO); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | data.put("SaleOutHeadVO", saleOutHeadVO); | 
|---|
|  |  |  | data.put("SaleOutBodyVO", saleOutBodyVOList); | 
|---|
|  |  |  | return data; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private Object processDBTK(String matnr, String batch, String orderNo, Double anfme, String cstateid) { | 
|---|
|  |  |  | List<NccSaleDbddWms> nccSaleDbddWmsList = nccSaleDbddWmsService.selectList(new EntityWrapper<NccSaleDbddWms>() | 
|---|
|  |  |  | .eq("wlbm", matnr) | 
|---|
|  |  |  | .eq("vbillcode", orderNo) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (nccSaleDbddWmsList.isEmpty()) { | 
|---|
|  |  |  | throw new CoolException("调拨订单ERP数据为空"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | NccSaleDbddWms nccSaleDbddWms = nccSaleDbddWmsList.get(0); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //组装对象数据 | 
|---|
|  |  |  | Map<String, Object> data = new HashMap<String, Object>(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<IaIjBillB> bids = new ArrayList<>(); | 
|---|
|  |  |  | IaIjBillB iaIjBillB = new IaIjBillB(); | 
|---|
|  |  |  | //        NccScPcdaWms nccScPcdaWms = nccScPcdaWmsService.selectOne(new EntityWrapper<NccScPcdaWms>().eq("vbatchcode", batch).eq("wlbm", matnr)); | 
|---|
|  |  |  | //        if (nccScPcdaWms == null) { | 
|---|
|  |  |  | //            throw new CoolException("批次[{}]物料[{}]未找到" + batch + "-" + matnr); | 
|---|
|  |  |  | //        } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Double weight = MatUtils.calcWeight(matnr, anfme); | 
|---|
|  |  |  | iaIjBillB.setBid(nccSaleDbddWms.getCbill_bid()); | 
|---|
|  |  |  | iaIjBillB.setNassistnum(weight * -1); | 
|---|
|  |  |  | iaIjBillB.setNnum(anfme * -1); | 
|---|
|  |  |  | iaIjBillB.setVbatchcode(batch); | 
|---|
|  |  |  | iaIjBillB.setClocationid(""); | 
|---|
|  |  |  | iaIjBillB.setCstateid(cstateid); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | bids.add(iaIjBillB); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | data.put("hid", nccSaleDbddWms.getCbillid()); | 
|---|
|  |  |  | data.put("bids", bids); | 
|---|
|  |  |  | return data; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private Object processInvcount(List<InventoryCheckOrderDetl> inventoryCheckOrderDetls, String cwarehouseid) { | 
|---|
|  |  |  | if (inventoryCheckOrderDetls.isEmpty()) { | 
|---|
|  |  |  | throw new CoolException("盘点明细不存在"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | HashMap<String, InventoryCheckOrderDetl> map = new HashMap<>(); | 
|---|
|  |  |  | for (InventoryCheckOrderDetl checkOrderDetl : inventoryCheckOrderDetls) { | 
|---|
|  |  |  | String key = checkOrderDetl.getMatnr() + "_" + checkOrderDetl.getBatch() + "_" + checkOrderDetl.getCstateid(); | 
|---|
|  |  |  | if (map.containsKey(key)) { | 
|---|
|  |  |  | InventoryCheckOrderDetl orderDetl = map.get(key); | 
|---|
|  |  |  | BigDecimal checkAnfmeDecimal = BigDecimal.valueOf(orderDetl.getCheckAnfme()); | 
|---|
|  |  |  | checkAnfmeDecimal = checkAnfmeDecimal.add(BigDecimal.valueOf(checkOrderDetl.getCheckAnfme())); | 
|---|
|  |  |  | //计算辅数量 | 
|---|
|  |  |  | Double weight = MatUtils.calcWeight(orderDetl.getMatnr(), checkAnfmeDecimal.doubleValue()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | orderDetl.setCheckAnfme(checkAnfmeDecimal.doubleValue()); | 
|---|
|  |  |  | orderDetl.setWeight(weight); | 
|---|
|  |  |  | map.put(key, orderDetl); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | //计算辅数量 | 
|---|
|  |  |  | Double weight = MatUtils.calcWeight(checkOrderDetl.getMatnr(), checkOrderDetl.getCheckAnfme()); | 
|---|
|  |  |  | checkOrderDetl.setWeight(weight); | 
|---|
|  |  |  | map.put(key, checkOrderDetl); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //组装对象数据 | 
|---|
|  |  |  | Map<String, Object> data = new HashMap<String, Object>(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | List<InvCountBodyVO> invCountBodyVOList = new ArrayList<>(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | for (Map.Entry<String, InventoryCheckOrderDetl> entry : map.entrySet()) { | 
|---|
|  |  |  | InventoryCheckOrderDetl checkOrderDetl = entry.getValue(); | 
|---|
|  |  |  | String matnr = checkOrderDetl.getMatnr(); | 
|---|
|  |  |  | String batch = checkOrderDetl.getBatch(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | NccScPcdaWms nccScPcdaWms = nccScPcdaWmsService.selectOne(new EntityWrapper<NccScPcdaWms>() | 
|---|
|  |  |  | .eq("WLBM", matnr) | 
|---|
|  |  |  | .eq("VBATCHCODE", batch) | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | if (null == nccScPcdaWms) { | 
|---|
|  |  |  | throw new CoolException("ERP数据库无法查询到盘点上报数据"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | InvCountBodyVO invCountBodyVO = new InvCountBodyVO(); | 
|---|
|  |  |  | invCountBodyVO.setCmaterialoid(matnr); | 
|---|
|  |  |  | invCountBodyVO.setVbatchcode(batch); | 
|---|
|  |  |  | invCountBodyVO.setNcountnum(checkOrderDetl.getCheckAnfme()); | 
|---|
|  |  |  | invCountBodyVO.setNcountastnum(checkOrderDetl.getWeight()); | 
|---|
|  |  |  | invCountBodyVO.setCstateid(checkOrderDetl.getCstateid()); | 
|---|
|  |  |  | invCountBodyVO.setPk_batchcode(nccScPcdaWms.getPkBatchcode()); | 
|---|
|  |  |  | invCountBodyVOList.add(invCountBodyVO); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | InvCountHeaderVO invCountHeaderVO = new InvCountHeaderVO(); | 
|---|
|  |  |  | invCountHeaderVO.setPk_org("FYT"); | 
|---|
|  |  |  | invCountHeaderVO.setCtrantypeid("4R-01"); | 
|---|
|  |  |  | invCountHeaderVO.setCwarehouseid(cwarehouseid); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | data.put("InvCountHeaderVO", invCountHeaderVO); | 
|---|
|  |  |  | data.put("InvCountBodyVO", invCountBodyVOList); | 
|---|
|  |  |  | data.put("paper", "1"); | 
|---|
|  |  |  | data.put("splr", "0"); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ArrayList<Map<String, Object>> list = new ArrayList<>(); | 
|---|
|  |  |  | list.add(data); | 
|---|
|  |  |  | return list; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private Object processZKRK(List<OrderDetl> orderDetls) { | 
|---|
|  |  |  | //组装对象数据 | 
|---|
|  |  |  | Map<String, Object> data = new HashMap<String, Object>(); | 
|---|
|  |  |  | GeneralInHeadVO generalInHeadVO = new GeneralInHeadVO(); | 
|---|
|  |  |  | generalInHeadVO.setPk_org("FYT"); | 
|---|
|  |  |  | generalInHeadVO.setCwarehouseid("6101"); | 
|---|
|  |  |  | GeneralInBodyVO generalInBodyVO = null; | 
|---|
|  |  |  | List<GeneralInBodyVO> generalInBodyVOS = new ArrayList<>(); | 
|---|
|  |  |  | for (OrderDetl orderDetl : orderDetls) { | 
|---|
|  |  |  | 
|---|
|  |  |  | generalInBodyVO.setNnum(orderDetl.getQty()); | 
|---|
|  |  |  | generalInBodyVO.setNshouldnum(orderDetl.getAnfme()); | 
|---|
|  |  |  | generalInBodyVO.setCsourcetype(nccScZkmxbWms.getZklxbm()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | generalInHeadVO.setCwarehouseid(orderDetl.getStandby1()); | 
|---|
|  |  |  | generalInBodyVOS.add(generalInBodyVO); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | data.put("GeneralInHeadVO", generalInHeadVO); | 
|---|
|  |  |  | 
|---|
|  |  |  | private Object processDBDD(List<OrderDetl> orderDetls) { | 
|---|
|  |  |  | //组装对象数据 | 
|---|
|  |  |  | Map<String, Object> data = new HashMap<String, Object>(); | 
|---|
|  |  |  | IaIjBill iaIjBill = new IaIjBill(); | 
|---|
|  |  |  | iaIjBill.setPk_org("FYT"); | 
|---|
|  |  |  | //iaIjBill.setCwarehouseid("6101"); | 
|---|
|  |  |  | IaIjBillB iaIjBillB = null; | 
|---|
|  |  |  | List<IaIjBillB> iaIjBillBS = new ArrayList<>(); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | String hid = ""; | 
|---|
|  |  |  | List<IaIjBillB> bids = new ArrayList<>(); | 
|---|
|  |  |  | for (OrderDetl orderDetl : orderDetls) { | 
|---|
|  |  |  | iaIjBillB = new IaIjBillB(); | 
|---|
|  |  |  | if (orderDetl.getQty() <= 0) { | 
|---|
|  |  |  | continue; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | IaIjBillB iaIjBillB = new IaIjBillB(); | 
|---|
|  |  |  | String remark = orderDetl.getRemark(); | 
|---|
|  |  |  | if (!Cools.isEmpty(remark)) { | 
|---|
|  |  |  | NccSaleDbddWms nccSaleXsfhmxWms = JSONObject.parseObject(remark, NccSaleDbddWms.class); | 
|---|
|  |  |  | iaIjBillB.setCinventoryid(nccSaleXsfhmxWms.getWlbm()); | 
|---|
|  |  |  | iaIjBillB.setCinventoryvid(nccSaleXsfhmxWms.getWlbm()); | 
|---|
|  |  |  | iaIjBillB.setCsrcid(nccSaleXsfhmxWms.getCbillid()); | 
|---|
|  |  |  | iaIjBillB.setNnum(orderDetl.getQty().intValue() + ""); | 
|---|
|  |  |  | iaIjBillB.setPk_org("FYT"); | 
|---|
|  |  |  | Double weight = MatUtils.calcWeight(orderDetl.getMatnr(), orderDetl.getQty()); | 
|---|
|  |  |  | NccSaleDbddWms nccSaleDbddWms = JSONObject.parseObject(remark, NccSaleDbddWms.class); | 
|---|
|  |  |  | iaIjBillB.setBid(nccSaleDbddWms.getCbill_bid()); | 
|---|
|  |  |  | iaIjBillB.setNassistnum(weight); | 
|---|
|  |  |  | iaIjBillB.setNnum(orderDetl.getQty()); | 
|---|
|  |  |  | iaIjBillB.setVbatchcode(orderDetl.getBatch()); | 
|---|
|  |  |  | iaIjBillB.setClocationid(""); | 
|---|
|  |  |  | iaIjBillB.setCstateid(orderDetl.getCstateidVcode()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | hid = nccSaleDbddWms.getCbillid(); | 
|---|
|  |  |  | bids.add(iaIjBillB); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | iaIjBillBS.add(iaIjBillB); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | data.put("ia_ijbill", iaIjBill); | 
|---|
|  |  |  | data.put("ia_ijbill_b", iaIjBillBS); | 
|---|
|  |  |  | data.put("hid", hid); | 
|---|
|  |  |  | data.put("bids", bids); | 
|---|
|  |  |  | return data; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private Object processZKCK(Order order, List<OrderDetl> orderDetls) { | 
|---|
|  |  |  | //组装对象数据 | 
|---|
|  |  |  | Map<String, Object> data = new HashMap<String, Object>(); | 
|---|
|  |  |  | WhsTransBillHeaderVO whsTransBillHeaderVO = new WhsTransBillHeaderVO(); | 
|---|
|  |  |  | whsTransBillHeaderVO.setPk_org("FYT"); | 
|---|
|  |  |  | whsTransBillHeaderVO.setCotherwhid(order.getItemId()); | 
|---|
|  |  |  | whsTransBillHeaderVO.setCtrantypeid("4K-01"); | 
|---|
|  |  |  | WhsTransBillBodyVO whsTransBillBodyVO = null; | 
|---|
|  |  |  | List<WhsTransBillBodyVO> whsTransBillBodyVOS = new ArrayList<>(); | 
|---|
|  |  |  | for (OrderDetl orderDetl : orderDetls) { | 
|---|
|  |  |  | whsTransBillBodyVO = new WhsTransBillBodyVO(); | 
|---|
|  |  |  | String remark = orderDetl.getRemark(); | 
|---|
|  |  |  | //if (!Cools.isEmpty(remark)) { | 
|---|
|  |  |  | //NccSaleXsfhmxWms nccSaleXsfhmxWms = JSONObject.parseObject(remark, NccSaleXsfhmxWms.class); | 
|---|
|  |  |  | whsTransBillBodyVO.setNnum(orderDetl.getQty()); | 
|---|
|  |  |  | whsTransBillBodyVO.setCmaterialoid(orderDetl.getMatnr()); | 
|---|
|  |  |  | whsTransBillBodyVO.setVbatchcode(orderDetl.getBatch()); | 
|---|
|  |  |  | //} | 
|---|
|  |  |  | whsTransBillHeaderVO.setCwarehouseid(orderDetl.getStandby1()); | 
|---|
|  |  |  | whsTransBillBodyVOS.add(whsTransBillBodyVO); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | data.put("WhsTransBillHeaderVO", whsTransBillHeaderVO); | 
|---|
|  |  |  | data.put("WhsTransBillBodyVO", whsTransBillBodyVOS); | 
|---|
|  |  |  | return data; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private Object processCGDH(List<OrderDetl> orderDetls) { | 
|---|
|  |  |  | 
|---|
|  |  |  | Map<String, Object> data = new HashMap<String, Object>(); | 
|---|
|  |  |  | ic_purchasein_h ic_purchasein_h = new ic_purchasein_h(); | 
|---|
|  |  |  | ic_purchasein_h.setPk_org("FYT"); | 
|---|
|  |  |  | ic_purchasein_h.setCwarehouseid("6301"); | 
|---|
|  |  |  | //ic_purchasein_h.setCwarehouseid("6301"); | 
|---|
|  |  |  | ic_purchasein_h.setCfanaceorgoid("FYT"); | 
|---|
|  |  |  | ic_purchasein_b ic_purchasein_b = null; | 
|---|
|  |  |  | List<ic_purchasein_b> ic_purchasein_bs = new ArrayList<>(); | 
|---|
|  |  |  | 
|---|
|  |  |  | ic_purchasein_b.setCsourcetype(nccCgCgdhdWms.getDhlxbm()); | 
|---|
|  |  |  | ic_purchasein_b.setVbatchcode(orderDetl.getBatch()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | ic_purchasein_h.setCwarehouseid(orderDetl.getStandby1()); | 
|---|
|  |  |  | ic_purchasein_bs.add(ic_purchasein_b); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | data.put("ic_purchasein_h", ic_purchasein_h); | 
|---|
|  |  |  | 
|---|
|  |  |  | return data; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @param orderDetls | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | private Object processGENERALOUT(List<OrderDetl> orderDetls) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private Object processZKCK(Order order, List<OrderDetl> orderDetls) { | 
|---|
|  |  |  | //组装对象数据 | 
|---|
|  |  |  | Map<String, Object> data = new HashMap<String, Object>(); | 
|---|
|  |  |  | ic_generalout_h generalout_h = new ic_generalout_h(); | 
|---|
|  |  |  | generalout_h.setPk_org("FYT"); | 
|---|
|  |  |  | generalout_h.setCwarehouseid("6101"); | 
|---|
|  |  |  | ic_generalout_b generalout_b = null; | 
|---|
|  |  |  | List<ic_generalout_b> ic_purchasein_bs = new ArrayList<>(); | 
|---|
|  |  |  | WhsTransBillHeaderVO whsTransBillHeaderVO = new WhsTransBillHeaderVO(); | 
|---|
|  |  |  | whsTransBillHeaderVO.setPk_org("FYT"); | 
|---|
|  |  |  | whsTransBillHeaderVO.setCotherwhid(order.getItemId()); | 
|---|
|  |  |  | whsTransBillHeaderVO.setCtrantypeid("4K-01"); | 
|---|
|  |  |  | WhsTransBillBodyVO whsTransBillBodyVO = null; | 
|---|
|  |  |  | List<WhsTransBillBodyVO> whsTransBillBodyVOS = new ArrayList<>(); | 
|---|
|  |  |  | for (OrderDetl orderDetl : orderDetls) { | 
|---|
|  |  |  | generalout_b = new ic_generalout_b(); | 
|---|
|  |  |  | String remark = orderDetl.getRemark(); | 
|---|
|  |  |  | if (!Cools.isEmpty(remark)) { | 
|---|
|  |  |  | NccSaleXsfhmxWms nccSaleXsfhmxWms = JSONObject.parseObject(remark, NccSaleXsfhmxWms.class); | 
|---|
|  |  |  | generalout_b.setCmaterialvid(orderDetl.getMatnr()); | 
|---|
|  |  |  | generalout_b.setNshouldassistnum(orderDetl.getQty()); | 
|---|
|  |  |  | generalout_b.setVbatchcode(orderDetl.getBatch()); | 
|---|
|  |  |  | NccScPcdaWms nccScPcdaWms = nccScPcdaWmsService.selectOne(new EntityWrapper<NccScPcdaWms>().eq("vbatchcode", orderDetl.getBatch()).eq("wlbm", orderDetl.getMatnr())); | 
|---|
|  |  |  | if (nccScPcdaWms == null) { | 
|---|
|  |  |  | throw new CoolException("批次[{}]物料[{}]未找到" + orderDetl.getBatch() + orderDetl.getMatnr()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | ic_purchasein_bs.add(generalout_b); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | whsTransBillBodyVO = new WhsTransBillBodyVO(); | 
|---|
|  |  |  | whsTransBillBodyVO.setCstateid(orderDetl.getCstateid()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | String remark = orderDetl.getRemark(); | 
|---|
|  |  |  | //if (!Cools.isEmpty(remark)) { | 
|---|
|  |  |  | //NccSaleXsfhmxWms nccSaleXsfhmxWms = JSONObject.parseObject(remark, NccSaleXsfhmxWms.class); | 
|---|
|  |  |  | whsTransBillBodyVO.setNnum(orderDetl.getQty()); | 
|---|
|  |  |  | whsTransBillBodyVO.setCmaterialoid(orderDetl.getMatnr()); | 
|---|
|  |  |  | whsTransBillBodyVO.setVbatchcode(orderDetl.getBatch()); | 
|---|
|  |  |  | whsTransBillBodyVO.setPk_batchcode(nccScPcdaWms.getPkBatchcode()); | 
|---|
|  |  |  | //} | 
|---|
|  |  |  | whsTransBillHeaderVO.setCwarehouseid(orderDetl.getStandby1()); | 
|---|
|  |  |  | whsTransBillBodyVOS.add(whsTransBillBodyVO); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | data.put("ic_generalout_h", generalout_h); | 
|---|
|  |  |  | data.put("ic_generalout_b", ic_purchasein_bs); | 
|---|
|  |  |  | data.put("WhsTransBillHeaderVO", whsTransBillHeaderVO); | 
|---|
|  |  |  | data.put("WhsTransBillBodyVO", whsTransBillBodyVOS); | 
|---|
|  |  |  | return data; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @param orderDetls | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | private Object processGENERALOUT2(List<OrderDetl> orderDetls, String memo) { | 
|---|
|  |  |  | private Object processGENERALOUT2(List<OrderDetl> orderDetls, String renyuan, String rukucangku, String memo) { | 
|---|
|  |  |  | Object o = JSONObject.parseArray(memo).get(0); | 
|---|
|  |  |  | JSONObject jsonObject = JSONObject.parseObject(o.toString()); | 
|---|
|  |  |  | String cspecialhid = JSONObject.parseObject(jsonObject.getString("ic.WhsTransBillHeaderVO")).getString("cspecialhid"); | 
|---|
|  |  |  | 
|---|
|  |  |  | Map<String, Object> data = new HashMap<String, Object>(); | 
|---|
|  |  |  | ic_generalout_h generalout_h = new ic_generalout_h(); | 
|---|
|  |  |  | generalout_h.setPk_org("FYT"); | 
|---|
|  |  |  | generalout_h.setCwarehouseid("6101"); | 
|---|
|  |  |  | //generalout_h.setCwarehouseid("6101"); | 
|---|
|  |  |  | ic_generalout_b generalout_b = null; | 
|---|
|  |  |  | List<ic_generalout_b> ic_purchasein_bs = new ArrayList<>(); | 
|---|
|  |  |  | for (int i = 0; i < orderDetls.size(); i++) { | 
|---|
|  |  |  | NccScPcdaWms nccScPcdaWms = nccScPcdaWmsService.selectOne(new EntityWrapper<NccScPcdaWms>().eq("vbatchcode", orderDetls.get(i).getBatch()).eq("wlbm", orderDetls.get(i).getMatnr())); | 
|---|
|  |  |  | if (nccScPcdaWms == null) { | 
|---|
|  |  |  | throw new CoolException("批次[{}]物料[{}]未找到" + orderDetls.get(i).getBatch() + orderDetls.get(i).getMatnr()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | OrderDetl orderDetl = orderDetls.get(i); | 
|---|
|  |  |  | generalout_h.setCwarehouseid(orderDetl.getStandby1()); | 
|---|
|  |  |  | generalout_b = new ic_generalout_b(); | 
|---|
|  |  |  | generalout_b.setCsourcebillbid(s.get(i)); | 
|---|
|  |  |  | generalout_b.setCsourcetype("4K-01"); | 
|---|
|  |  |  | generalout_b.setCsourcebillhid(cspecialhid); | 
|---|
|  |  |  | generalout_b.setCmaterialvid(orderDetl.getMatnr()); | 
|---|
|  |  |  | generalout_b.setNshouldassistnum(orderDetl.getQty()); | 
|---|
|  |  |  | generalout_b.setCstateid(orderDetl.getCstateid()); | 
|---|
|  |  |  | generalout_b.setPk_batchcode(nccScPcdaWms.getPkBatchcode()); | 
|---|
|  |  |  | StoreType storeType = storeTypeService.selectOne(new EntityWrapper<StoreType>().eq("store_id", orderDetl.getStandby1())); | 
|---|
|  |  |  | generalout_b.setCdptvid(storeType.getDepartmentId()); | 
|---|
|  |  |  | generalout_b.setBillmaker(renyuan); | 
|---|
|  |  |  | StoreType storeType2 = storeTypeService.selectOne(new EntityWrapper<StoreType>().eq("store_id", rukucangku)); | 
|---|
|  |  |  | generalout_b.setCotherwhid(rukucangku); | 
|---|
|  |  |  | generalout_b.setCothercalbodyvid(storeType2.getDepartmentId()); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //generalout_b.setNshouldassistnum(orderDetl.getQty()); | 
|---|
|  |  |  | generalout_b.setNnum(orderDetl.getQty()); | 
|---|
|  |  |  | generalout_b.setVbatchcode(orderDetl.getBatch()); | 
|---|
|  |  |  | ic_purchasein_bs.add(generalout_b); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private Boolean reportApiLog(Object data, String docType, String url, String path) { | 
|---|
|  |  |  | String response = ""; | 
|---|
|  |  |  | boolean success = false; | 
|---|
|  |  |  | private Boolean reportApiLog(Order order, Object process1, Object process2, Object response, String docType, String url, String path, Boolean success) { | 
|---|
|  |  |  | HashMap<String, Object> request = new HashMap<>(); | 
|---|
|  |  |  | request.put("order", order); | 
|---|
|  |  |  | request.put("process1", process1); | 
|---|
|  |  |  | request.put("process2", process2); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | apiLogService.save( | 
|---|
|  |  |  | docType, | 
|---|
|  |  |  | url + path, | 
|---|
|  |  |  | null, | 
|---|
|  |  |  | "127.0.0.1", | 
|---|
|  |  |  | JSON.toJSONString(data), | 
|---|
|  |  |  | response, | 
|---|
|  |  |  | JSON.toJSONString(request), | 
|---|
|  |  |  | JSON.toJSONString(response), | 
|---|
|  |  |  | success | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | return false; | 
|---|