| | |
| | | import org.jeecg.modules.tms.entity.vo.InboundDetailVo; |
| | | import org.jeecg.modules.tms.mapper.InboundOrderMapper; |
| | | import org.jeecg.modules.tms.service.*; |
| | | import org.jeecg.modules.tms.utils.QrCodePrinterUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void addInStorage(JSONObject jSONObject) { |
| | | public List<Map<String,String>> addInStorage(JSONObject jSONObject) { |
| | | String inStorehouseType = jSONObject.getString("inStorehouseType"); |
| | | String locationCodeId = jSONObject.getString("locationCodeId"); |
| | | //二维码打印列表 |
| | | List<Map<String,String>> results = new ArrayList<>(); |
| | | List<String> contentList = new ArrayList<>(); |
| | | String classifyId = jSONObject.getString("classifyId"); |
| | | Date inboundTime = jSONObject.getDate("inboundTime"); |
| | | //获取入库明细 |
| | |
| | | //增加库存明细 |
| | | ToolLedgerDetail toolLedgerDetail = new ToolLedgerDetail(); |
| | | toolLedgerDetail.setToolCode(inboundDetailVo.getToolCodeId()); |
| | | toolLedgerDetail.setPositionCode(locationCodeId); |
| | | toolLedgerDetail.setToolId(inboundDetailVo.getToolCode()+"-"+result); |
| | | toolLedgerDetail.setQuantity(BigDecimal.ONE); |
| | | toolLedgerDetail.setRemainingPercentage(BigDecimal.ONE); |
| | | toolLedgerDetail.setStatus("1"); |
| | | toolLedgerDetailService.save(toolLedgerDetail); |
| | | //更新当前编码 |
| | | newBaseTools.setCurrentCode(result); |
| | | baseToolsService.updateById(newBaseTools); |
| | | //打印二维码 |
| | | contentList.add(inboundDetailVo.getToolCode()+"-"+result); |
| | | } |
| | | //打印二维码,暂时注释,待现场调试打标机 |
| | | // for(String content : contentList){ |
| | | // Map<String,String> result = new HashMap<>(); |
| | | // result.put("content",content); |
| | | // result.put("image", QrCodePrinterUtils.generateBacthQRCode(content, 200, 200)); |
| | | // // 生成二维码图片(Base64) |
| | | // results.add(result); |
| | | // } |
| | | Map<String,String> result = new HashMap<>(); |
| | | result.put("content","保存成功"); |
| | | results.add(result); |
| | | //不管到把 |
| | | }else { |
| | | //保存入库流水 |
| | |
| | | ToolLedgerDetail newToolLedgerDetail = new ToolLedgerDetail(); |
| | | newToolLedgerDetail.setToolCode(inboundDetailVo.getToolCodeId()); |
| | | newToolLedgerDetail.setQuantity(inboundDetailVo.getInStorageQuantity()); |
| | | newToolLedgerDetail.setPositionCode(locationCodeId); |
| | | newToolLedgerDetail.setStatus("1"); |
| | | toolLedgerDetailService.save(newToolLedgerDetail); |
| | | }else { |
| | | toolLedgerDetail.setQuantity(toolLedgerDetail.getQuantity().add(inboundDetailVo.getInStorageQuantity())); |
| | | toolLedgerDetail.setPositionCode(locationCodeId); |
| | | toolLedgerDetailService.updateById(toolLedgerDetail); |
| | | } |
| | | Map<String,String> result = new HashMap<>(); |
| | | result.put("content","保存成功"); |
| | | results.add(result); |
| | | } |
| | | } |
| | | //归还入库 |
| | |
| | | .eq(ToolLedgerDetail::getToolCode,inboundDetailVo.getToolCodeId()) |
| | | .eq(ToolLedgerDetail::getToolId,inboundDetailVo.getOnlyCode()).one(); |
| | | toolLedgerDetail.setQuantity(BigDecimal.ONE); |
| | | toolLedgerDetail.setRemainingPercentage(BigDecimal.ONE); |
| | | toolLedgerDetail.setPositionCode(locationCodeId); |
| | | toolLedgerDetail.setStatus("1"); |
| | | toolLedgerDetailService.updateById(toolLedgerDetail); |
| | | //保存入库流水 |
| | |
| | | //增加库存明细可用库存,修改状态 |
| | | ToolLedgerDetail toolLedgerDetail = toolLedgerDetailService.lambdaQuery().eq(ToolLedgerDetail::getToolCode,inboundDetailVo.getToolCodeId()).one(); |
| | | toolLedgerDetail.setQuantity(toolLedgerDetail.getQuantity().add(inboundDetailVo.getInStorageQuantity())); |
| | | toolLedgerDetail.setPositionCode(locationCodeId); |
| | | toolLedgerDetail.setStatus("1"); |
| | | toolLedgerDetailService.updateById(toolLedgerDetail); |
| | | //保存入库流水 |
| | |
| | | } |
| | | |
| | | } |
| | | Map<String,String> result = new HashMap<>(); |
| | | result.put("content","保存成功"); |
| | | results.add(result); |
| | | }else if("5".equals(inStorehouseType)){ |
| | | //循环新增明细 |
| | | for(InboundDetailVo inboundDetailVo : inStoreDetailList) { |
| | |
| | | .eq(ToolLedgerDetail::getToolCode,inboundDetailVo.getToolCodeId()) |
| | | .eq(ToolLedgerDetail::getToolId,inboundDetailVo.getOnlyCode()).one(); |
| | | toolLedgerDetail.setQuantity(BigDecimal.ONE); |
| | | toolLedgerDetail.setRemainingPercentage(BigDecimal.ONE); |
| | | toolLedgerDetail.setPositionCode(locationCodeId); |
| | | toolLedgerDetail.setStatus("1"); |
| | | toolLedgerDetailService.updateById(toolLedgerDetail); |
| | | //保存入库流水 |
| | |
| | | //增加库存明细可用库存,修改状态 |
| | | ToolLedgerDetail toolLedgerDetail = toolLedgerDetailService.lambdaQuery().eq(ToolLedgerDetail::getToolCode,inboundDetailVo.getToolCodeId()).one(); |
| | | toolLedgerDetail.setQuantity(toolLedgerDetail.getQuantity().add(inboundDetailVo.getInStorageQuantity())); |
| | | toolLedgerDetail.setPositionCode(locationCodeId); |
| | | toolLedgerDetail.setStatus("1"); |
| | | toolLedgerDetailService.updateById(toolLedgerDetail); |
| | | //保存入库流水 |
| | |
| | | } |
| | | |
| | | } |
| | | Map<String,String> result = new HashMap<>(); |
| | | result.put("content","保存成功"); |
| | | results.add(result); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | @Override |
| | | public void addApplyInStorage(JSONObject jSONObject) { |
| | | public List<Map<String,String>> addApplyInStorage(JSONObject jSONObject) { |
| | | String inStorehouseType = jSONObject.getString("inStorehouseType"); |
| | | String locationCodeId = jSONObject.getString("locationCodeId"); |
| | | //二维码打印列表 |
| | | List<Map<String,String>> results = new ArrayList<>(); |
| | | List<String> contentList = new ArrayList<>(); |
| | | //入库申请单id |
| | | String orderId = jSONObject.getString("orderId"); |
| | | //获取入库明细 |
| | |
| | | toolLedgerDetail.setToolCode(inboundDetailVo.getToolCodeId()); |
| | | toolLedgerDetail.setToolId(inboundDetailVo.getToolCode()+"-"+result); |
| | | toolLedgerDetail.setQuantity(BigDecimal.ONE); |
| | | toolLedgerDetail.setRemainingPercentage(BigDecimal.ONE); |
| | | toolLedgerDetail.setPositionCode(locationCodeId); |
| | | toolLedgerDetail.setStatus("1"); |
| | | toolLedgerDetailService.save(toolLedgerDetail); |
| | | //更新当前编码 |
| | | newBaseTools.setCurrentCode(result); |
| | | baseToolsService.updateById(newBaseTools); |
| | | //打印二维码 |
| | | contentList.add(inboundDetailVo.getToolCode()+"-"+result); |
| | | } |
| | | //打印二维码,暂时注释,待现场验证打标机 |
| | | // for(String content : contentList){ |
| | | // Map<String,String> result = new HashMap<>(); |
| | | // result.put("content",content); |
| | | // result.put("image", QrCodePrinterUtils.generateBacthQRCode(content, 200, 200)); |
| | | // // 生成二维码图片(Base64) |
| | | // results.add(result); |
| | | // } |
| | | Map<String,String> result = new HashMap<>(); |
| | | result.put("content","保存成功"); |
| | | results.add(result); |
| | | //不管到把 |
| | | }else { |
| | | //保存入库流水 |
| | |
| | | ToolLedgerDetail newToolLedgerDetail = new ToolLedgerDetail(); |
| | | newToolLedgerDetail.setToolCode(inboundDetailVo.getToolCodeId()); |
| | | newToolLedgerDetail.setQuantity(inboundDetailVo.getInStorageQuantity()); |
| | | newToolLedgerDetail.setPositionCode(locationCodeId); |
| | | newToolLedgerDetail.setStatus("1"); |
| | | toolLedgerDetailService.save(newToolLedgerDetail); |
| | | }else { |
| | | toolLedgerDetail.setQuantity(toolLedgerDetail.getQuantity().add(inboundDetailVo.getInStorageQuantity())); |
| | | toolLedgerDetail.setPositionCode(locationCodeId); |
| | | toolLedgerDetailService.updateById(toolLedgerDetail); |
| | | } |
| | | Map<String,String> result = new HashMap<>(); |
| | | result.put("content","保存成功"); |
| | | results.add(result); |
| | | } |
| | | //更改明细入库状态及实际入库数量 |
| | | InboundDetail inboundDetail = inboundDetailService.getById(inboundDetailVo.getId()); |
| | |
| | | .eq(ToolLedgerDetail::getToolCode,inboundDetailVo.getToolCodeId()) |
| | | .eq(ToolLedgerDetail::getToolId,inboundDetailVo.getOnlyCode()).one(); |
| | | toolLedgerDetail.setQuantity(BigDecimal.ONE); |
| | | toolLedgerDetail.setRemainingPercentage(BigDecimal.ONE); |
| | | toolLedgerDetail.setPositionCode(locationCodeId); |
| | | toolLedgerDetail.setStatus("1"); |
| | | toolLedgerDetailService.updateById(toolLedgerDetail); |
| | | //保存入库流水 |
| | |
| | | ToolLedgerDetail toolLedgerDetail = toolLedgerDetailService.lambdaQuery().eq(ToolLedgerDetail::getToolCode,inboundDetailVo.getToolCodeId()).one(); |
| | | toolLedgerDetail.setQuantity(toolLedgerDetail.getQuantity().add(inboundDetailVo.getInStorageQuantity())); |
| | | toolLedgerDetail.setStatus("1"); |
| | | toolLedgerDetail.setPositionCode(locationCodeId); |
| | | toolLedgerDetailService.updateById(toolLedgerDetail); |
| | | //保存入库流水 |
| | | InStoreDetail inStoreDetail = new InStoreDetail(); |
| | |
| | | inboundDetail.setInActualCount(inboundDetailVo.getInStorageQuantity()); |
| | | inboundDetailService.updateById(inboundDetail); |
| | | } |
| | | Map<String,String> result = new HashMap<>(); |
| | | result.put("content","保存成功"); |
| | | results.add(result); |
| | | }else if("5".equals(inStorehouseType)){ |
| | | //循环新增明细 |
| | | for(InboundDetailVo inboundDetailVo : inStoreDetailList) { |
| | |
| | | .eq(ToolLedgerDetail::getToolCode,inboundDetailVo.getToolCodeId()) |
| | | .eq(ToolLedgerDetail::getToolId,inboundDetailVo.getOnlyCode()).one(); |
| | | toolLedgerDetail.setQuantity(BigDecimal.ONE); |
| | | toolLedgerDetail.setRemainingPercentage(BigDecimal.ONE); |
| | | toolLedgerDetail.setPositionCode(locationCodeId); |
| | | toolLedgerDetail.setStatus("1"); |
| | | toolLedgerDetailService.updateById(toolLedgerDetail); |
| | | //保存入库流水 |
| | |
| | | ToolLedgerDetail toolLedgerDetail = toolLedgerDetailService.lambdaQuery().eq(ToolLedgerDetail::getToolCode,inboundDetailVo.getToolCodeId()).one(); |
| | | toolLedgerDetail.setQuantity(toolLedgerDetail.getQuantity().add(inboundDetailVo.getInStorageQuantity())); |
| | | toolLedgerDetail.setStatus("1"); |
| | | toolLedgerDetail.setPositionCode(locationCodeId); |
| | | toolLedgerDetailService.updateById(toolLedgerDetail); |
| | | //保存入库流水 |
| | | InStoreDetail inStoreDetail = new InStoreDetail(); |
| | |
| | | inboundDetail.setInActualCount(inboundDetailVo.getInStorageQuantity()); |
| | | inboundDetailService.updateById(inboundDetail); |
| | | } |
| | | Map<String,String> result = new HashMap<>(); |
| | | result.put("content","保存成功"); |
| | | results.add(result); |
| | | } |
| | | //更改申请单入库状态 |
| | | InboundOrder inboundOrder = this.getById(orderId); |
| | |
| | | inboundOrder.setInStatus("2"); |
| | | } |
| | | this.updateById(inboundOrder); |
| | | return results; |
| | | } |
| | | |
| | | private LoginUser getCurrentUser() { |