| | |
| | | import com.example.erp.entity.userInfo.SysError; |
| | | import com.example.erp.mapper.mm.BasicWarehouseTypeMapper; |
| | | import com.example.erp.mapper.mm.MaterialInventoryMapper; |
| | | import com.example.erp.mapper.mm.MaterialLogMapper; |
| | | import com.example.erp.mapper.mm.MaterialStoreMapper; |
| | | import com.example.erp.service.userInfo.LogService; |
| | | import com.example.erp.service.userInfo.SysErrorService; |
| | |
| | | SysErrorService sysErrorService; |
| | | @Autowired |
| | | LogService logService; |
| | | @Autowired |
| | | MaterialLogMapper materialLogMapper; |
| | | |
| | | public String saveMaterialOutbound(Map<String,Object> object) { |
| | | String saveState = "true"; |
| | |
| | | //修改物料库存表出库数量 |
| | | materialInventoryMapper.updateMaterialInventoryAvailableOut(materialOutboundDetail.getId(), materialOutboundDetail.getOutboundQuantity()); |
| | | }*/ |
| | | String json=""; |
| | | MaterialStore materialStore=materialStoreMapper.getSelectMaterialStoreById(Long.valueOf(materialOutboundDetail.getMaterialCode())); |
| | | json=materialStore.getJson().substring(1, materialStore.getJson().length() - 1); |
| | | MaterialLog materialLog=new MaterialLog(); |
| | | materialLog.setOperationOrderNumber(oddNumber); |
| | | materialLog.setOperationNumber(materialOutboundDetailMaximum + 1); |
| | | materialLog.setOperateType("物料出库"); |
| | | materialLog.setMaterialCode(Long.valueOf(materialOutboundDetail.getMaterialCode())); |
| | | materialLog.setMaterialName(convertString(json,"\"name\"")); |
| | | materialLog.setProducer(materialInventory.getProducer()); |
| | | materialLog.setUnit(convertString(json,"\"unit\"")); |
| | | materialLog.setWidth(convertDouble(json,"\"width\"")); |
| | | materialLog.setHeight(convertDouble(json,"\"height\"")); |
| | | materialLog.setThickness(convertDouble(json,"\"thickness\"")); |
| | | materialLog.setQuantity(materialOutboundDetail.getOutboundQuantity()); |
| | | materialLog.setSinglePieceArea(materialOutboundDetail.getSinglePieceArea()); |
| | | materialLog.setInventoryId(materialOutboundDetail.getId()); |
| | | materialLog.setInventoryArea(materialInventory.getInventoryArea()); |
| | | materialLog.setRemarks(materialOutboundDetail.getRemarks()); |
| | | materialLog.setOperator(object.get("userName").toString()); |
| | | materialLog.setOperateTime(LocalDate.now()); |
| | | materialLogMapper.insert(materialLog); |
| | | }else{ |
| | | TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint); |
| | | return "false1"; |
| | |
| | | materialInventoryMapper.insertMaterialInventory(materialCode,singlePieceArea,totalArea,materialInventory); |
| | | log.setFunction("saveMaterialInventory新增"); |
| | | } |
| | | |
| | | String json=""; |
| | | MaterialStore materialStore=materialStoreMapper.getSelectMaterialStoreById(materialCode); |
| | | json=materialStore.getJson().substring(1, materialStore.getJson().length() - 1); |
| | | MaterialLog materialLog=new MaterialLog(); |
| | | materialLog.setOperateType("物料新增"); |
| | | materialLog.setMaterialCode(materialCode); |
| | | materialLog.setMaterialName(convertString(json,"\"name\"")); |
| | | materialLog.setProducer(materialInventory.getProducer()); |
| | | materialLog.setUnit(convertString(json,"\"unit\"")); |
| | | materialLog.setWidth(convertDouble(json,"\"width\"")); |
| | | materialLog.setHeight(convertDouble(json,"\"height\"")); |
| | | materialLog.setThickness(convertDouble(json,"\"thickness\"")); |
| | | materialLog.setQuantity(materialInventory.getInventoryQuantity()); |
| | | materialLog.setSinglePieceArea(singlePieceArea); |
| | | materialLog.setInventoryId(materialInventory.getId()); |
| | | materialLog.setInventoryArea(materialInventory.getInventoryArea()); |
| | | materialLog.setRemarks(materialInventory.getRemarks()); |
| | | materialLog.setOperator(object.get("userName").toString()); |
| | | materialLog.setOperateTime(LocalDate.now()); |
| | | materialLogMapper.insert(materialLog); |
| | | logService.saveLog(log); |
| | | } catch (Exception e) { |
| | | TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint); |
| | |
| | | json=materialStore.getJson().substring(1, materialStore.getJson().length() - 1); |
| | | |
| | | |
| | | double width= convert(json,"\"width\""); |
| | | double height=convert(json,"\"height\""); |
| | | double width= convertDouble(json,"\"width\""); |
| | | double height= convertDouble(json,"\"height\""); |
| | | DecimalFormat decimalFormat = new DecimalFormat("#0.00"); |
| | | singlePieceArea= Double.parseDouble(decimalFormat.format(width * height / 100000)); |
| | | totalArea= Double.parseDouble(decimalFormat.format(singlePieceArea * returningWarehouseDetail.getReturnQuantity())); |
| | |
| | | materialInventoryMapper.updateReturningWarehouseDetail(oddNumber, returningWarehouseDetailMaximum + 1,MaterialInventoryId.get(0).getId()); |
| | | |
| | | |
| | | |
| | | MaterialLog materialLog=new MaterialLog(); |
| | | materialLog.setOperationOrderNumber(oddNumber); |
| | | materialLog.setOperationNumber(returningWarehouseDetailMaximum + 1); |
| | | materialLog.setOperateType("物料返库"); |
| | | materialLog.setMaterialCode(returningWarehouseDetail.getId()); |
| | | materialLog.setMaterialName(convertString(json,"\"name\"")); |
| | | materialLog.setProducer(returningWarehouseDetail.getProducer()); |
| | | materialLog.setUnit(convertString(json,"\"unit\"")); |
| | | materialLog.setWidth(convertDouble(json,"\"width\"")); |
| | | materialLog.setHeight(convertDouble(json,"\"height\"")); |
| | | materialLog.setThickness(convertDouble(json,"\"thickness\"")); |
| | | materialLog.setQuantity(returningWarehouseDetail.getReturnQuantity()); |
| | | materialLog.setSinglePieceArea(singlePieceArea); |
| | | materialLog.setInventoryArea(returningWarehouseDetail.getInventoryArea()); |
| | | materialLog.setRemarks(returningWarehouseDetail.getRemarks()); |
| | | materialLog.setOperator(object.get("userName").toString()); |
| | | materialLog.setOperateTime(LocalDate.now()); |
| | | materialLogMapper.insert(materialLog); |
| | | |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | public double convert(String json,String string) { |
| | | public String convertString(String json,String string) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | String[] keyValues = json.split(","); |
| | | for (String keyValue : keyValues) { |
| | |
| | | map.put(pair[0], pair[1]); |
| | | } |
| | | } |
| | | double number=0.0; |
| | | return map.get(string).toString().replace("\"",""); |
| | | } |
| | | |
| | | public Double convertDouble(String json,String string) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | String[] keyValues = json.split(","); |
| | | for (String keyValue : keyValues) { |
| | | String[] pair = keyValue.split(":"); |
| | | if (pair.length == 2) { |
| | | map.put(pair[0], pair[1]); |
| | | } |
| | | } |
| | | Double number=0.0; |
| | | if(map.get(string)!=null){ |
| | | String[] widthStrings = map.get(string).toString().split("\\D+"); |
| | | for (String numberString : widthStrings) { |