| | |
| | | |
| | | } |
| | | |
| | | public Boolean saveMaterialInventory(Map<String,Object> object) { |
| | | boolean saveState = true; |
| | | public String saveMaterialInventory(Map<String,Object> object) { |
| | | String saveState = "true"; |
| | | //设置回滚点 |
| | | Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint(); |
| | | try { |
| | |
| | | |
| | | MaterialInventory materialInventory = JSONObject.parseObject(JSONObject.toJSONString(object.get("title")), MaterialInventory.class); |
| | | |
| | | //查询物料是否存在 |
| | | Integer MaterialInventoryCount = materialInventoryMapper.getMaterialInventoryCount(materialCode,materialInventory.getDateOfManufacture()); |
| | | |
| | | if(MaterialInventoryCount>0){ |
| | | materialInventoryMapper.updateMaterialInventory(materialCode,singlePieceArea,totalArea,materialInventory); |
| | | //查询物料是否存在 |
| | | Integer MaterialInventoryCount=0; |
| | | if (materialInventory.getDateOfManufacture()!=null){ |
| | | MaterialInventoryCount = materialInventoryMapper.getMaterialInventoryCount(materialCode,materialInventory.getDateOfManufacture()); |
| | | }else{ |
| | | MaterialInventoryCount = materialInventoryMapper.getMaterialInventoryCountNull(materialCode); |
| | | } |
| | | |
| | | if(MaterialInventoryCount==1){ |
| | | if (materialInventory.getDateOfManufacture()!=null){ |
| | | materialInventoryMapper.updateMaterialInventory(materialCode,singlePieceArea,totalArea,materialInventory); |
| | | }else{ |
| | | materialInventoryMapper.updateMaterialInventoryNull(materialCode,singlePieceArea,totalArea,materialInventory); |
| | | } |
| | | log.setFunction("saveMaterialInventory修改"); |
| | | }else { |
| | | }else if(MaterialInventoryCount==0) { |
| | | materialInventoryMapper.insertMaterialInventory(materialCode,singlePieceArea,totalArea,materialInventory); |
| | | log.setFunction("saveMaterialInventory新增"); |
| | | }else { |
| | | return "false1"; |
| | | } |
| | | |
| | | String json=""; |
| | |
| | | sysError.setError(e+Arrays.toString(e.getStackTrace())); |
| | | sysError.setFunc("saveMaterialInventory"); |
| | | sysErrorService.insert(sysError); |
| | | saveState = false; |
| | | saveState = "false"; |
| | | |
| | | } |
| | | return saveState; |
| | |
| | | if(materialOutboundId!=null){ |
| | | materialInventoryMapper.deleteMaterialOutboundDetail(materialOutboundId); |
| | | materialInventoryMapper.deleteMaterialOutbound(materialOutboundId); |
| | | materialInventoryMapper.deleteMaterialLog(materialOutboundId); |
| | | } |
| | | Log log = new Log(); |
| | | log.setContent(object.toString()); |
| | |
| | | |
| | | } |
| | | |
| | | public Boolean deleteReturnToStorage(Map<String,Object> object) { |
| | | boolean saveState = true; |
| | | //设置回滚点 |
| | | Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint(); |
| | | try { |
| | | String returningId = ""; |
| | | if (object.get("returningId") != null) { |
| | | returningId = object.get("returningId").toString(); |
| | | } |
| | | if(returningId!=null){ |
| | | materialInventoryMapper.deleteReturningWarehouseDetail(returningId); |
| | | materialInventoryMapper.deleteReturningWarehouse(returningId); |
| | | materialInventoryMapper.deleteMaterialLog(returningId); |
| | | } |
| | | Log log = new Log(); |
| | | log.setContent(object.toString()); |
| | | log.setOperatorId(object.get("userId").toString()); |
| | | log.setOperator(object.get("userName").toString()); |
| | | log.setFunction("deleteReturnToStorage:"+returningId); |
| | | logService.saveLog(log); |
| | | |
| | | |
| | | } catch (Exception e) { |
| | | TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint); |
| | | //将异常传入数据库 |
| | | SysError sysError = new SysError(); |
| | | sysError.setError(e+Arrays.toString(e.getStackTrace())); |
| | | sysError.setFunc("deleteMaterialOutbound"); |
| | | sysErrorService.insert(sysError); |
| | | saveState = false; |
| | | |
| | | } |
| | | return saveState; |
| | | |
| | | } |
| | | |
| | | public Map<String, Object> getSelectMaterialOutboundDate(Integer pageNum, Integer pageSize, List<String> selectDate, MaterialOutbound materialOutbound) { |
| | | Integer offset = (pageNum - 1) * pageSize; |
| | | String endDate = LocalDate.now().toString(); |