| | |
| | | } |
| | | Tag tag = tagService.selectByName("全部", 1); |
| | | |
| | | Mat mat = matService.selectByMatnr(param.getCInvCCode()); |
| | | Mat mat = matService.selectByMatnr(param.getCInvCode()); |
| | | if (Cools.isEmpty(mat)) { |
| | | mat = new Mat(); |
| | | mat.setTagId(tag.getId()); |
| | |
| | | |
| | | private void syncMat(Mat mat, MatSyncParam param){ |
| | | Date date = new Date(); |
| | | mat.setMatnr(param.getCInvCCode());//物料编码 |
| | | mat.setMatnr(param.getCInvCode());//物料编码 |
| | | mat.setMaktx(param.getCInvName());//物料名称 |
| | | mat.setSpecs(param.getCInvStd());//规格 |
| | | mat.setUnit(param.getCComUnitName()); |
| | | mat.setBeBatch(param.getBInvBatch()); |
| | | mat.setBeBatch(Cools.eq("true",param.getBInvBatch()) ? 1 : 0); |
| | | mat.setStatus(param.getStates()); |
| | | |
| | | mat.setCreateBy(9999L);//9999表示erp下发 |
| | |
| | | throw new CoolException("单据参数为空或者单据详情为空,无法生成单据信息"); |
| | | } |
| | | |
| | | Order orderOld = null; |
| | | |
| | | if(!Cools.isEmpty(orderService.selectByNo(param.getCPOID()))){ |
| | | callApiLogSave(param, "/order/pakout/default/v1", "接受单据失败,该单据已存在,无法生成单据信息", false); |
| | | throw new CoolException("该单据已存在,无法生成单据信息"); |
| | | |
| | | orderOld = orderService.selectByNo(param.getCPOID()); |
| | | if(orderOld.getSettle() > 1){ |
| | | throw new CoolException("该单据已在作业中,无法更改单据信息"); |
| | | } |
| | | |
| | | // String orderNo = param.getCPOID(); |
| | | // if (orderNo.contains("-")){ |
| | | // int index = Integer.parseInt(orderNo.split("-")[1]) + 1; |
| | | // orderNo = orderNo.split("-")[0] + "-" + index; |
| | | // param.setcPOID(orderNo); |
| | | // }else { |
| | | // orderNo = orderNo + "-1"; |
| | | // param.setcPOID(orderNo); |
| | | // } |
| | | // |
| | | // syncOrder(param,pakin,docName); |
| | | |
| | | //callApiLogSave(param, "/order/pakout/default/v1", "接受单据失败,该单据已存在,无法生成单据信息", false); |
| | | //throw new CoolException("该单据已存在,无法生成单据信息"); |
| | | } |
| | | Date now = new Date(); |
| | | Order order = orderMapping(param,now,pakin,docName); |
| | |
| | | OrderDetl orderDetl = orderDetlMapping(order,od,now); |
| | | orderDetlService.insert(orderDetl); |
| | | }); |
| | | |
| | | if(!Cools.isEmpty(orderOld)){ |
| | | //删除原有单据信息 |
| | | orderService.delete(new EntityWrapper<Order>().eq("id",orderOld.getId())); |
| | | orderDetlService.delete(new EntityWrapper<OrderDetl>().eq("order_id",orderOld.getId())); |
| | | } |
| | | |
| | | callApiLogSave(param, "/order/pakout/default/v1", "接受单据成功", true); |
| | | |
| | |
| | | } |
| | | |
| | | orderService.deleteById(order); |
| | | orderDetlService.delete(new EntityWrapper<OrderDetl>().eq("order_no",orderNo)); |
| | | orderDetlService.delete(new EntityWrapper<OrderDetl>().eq("order_id",order.getId())); |
| | | |
| | | return true; |
| | | } |
| | |
| | | order.setMemo(param.getCMemo()); |
| | | //制单人 |
| | | order.setShipCode(param.getCPersonCode()); |
| | | |
| | | order.setDefNumber(param.get操作系统号()); |
| | | |
| | | order.setCreateTime(now); |
| | | order.setUpdateTime(now); |
| | |
| | | //数量 |
| | | od.setAnfme(odParam.getIQuantity()); |
| | | //销售订单号 |
| | | od.setThreeCode(odParam.getCsocode()); |
| | | od.setThreeCode(odParam.getCDefine22()); |
| | | //自由项 |
| | | od.setDeadTime(odParam.getBFree1()); |
| | | //IDs |
| | | od.setSku(odParam.getID()); |
| | | od.setSku(odParam.getId()); |
| | | |
| | | od.setLength(odParam.getINum()); |
| | | |
| | | od.setStatus(1); |
| | | od.setQty(0.0D); |