| | |
| | | import com.java110.core.event.cmd.Cmd; |
| | | import com.java110.core.event.cmd.CmdEvent; |
| | | import com.java110.core.factory.GenerateCodeFactory; |
| | | import com.java110.dto.allocationStorehouse.AllocationStorehouseDto; |
| | | import com.java110.dto.purchaseApply.PurchaseApplyDto; |
| | | import com.java110.intf.store.IAssetInventoryDetailV1InnerServiceSMO; |
| | | import com.java110.intf.store.IAssetInventoryV1InnerServiceSMO; |
| | | import com.java110.intf.store.IAllocationStorehouseApplyInnerServiceSMO; |
| | | import com.java110.intf.store.IAllocationStorehouseInnerServiceSMO; |
| | | import com.java110.intf.store.IPurchaseApplyInnerServiceSMO; |
| | | import com.java110.po.assetInventory.AssetInventoryPo; |
| | | import com.java110.po.assetInventoryDetail.AssetInventoryDetailPo; |
| | | import com.java110.po.assetInventory.AssetInventoryDetailPo; |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import com.java110.vo.ResultVo; |
| | | import com.java110.vo.api.purchaseApply.PurchaseApplyDetailVo; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 类表述:保存 |
| | |
| | | public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException { |
| | | AssetInventoryPo assetInventoryPo = BeanConvertUtil.covertBean(reqJson, AssetInventoryPo.class); |
| | | |
| | | PurchaseApplyDto purchaseApplyDto = new PurchaseApplyDto(); |
| | | purchaseApplyDto.setCommunityId(assetInventoryPo.getCommunityId()); |
| | | purchaseApplyDto.setState(purchaseApplyDto.STATE_DEALING);//审核中 |
| | | List<PurchaseApplyDto> purchaseApplyDtos = purchaseApplyInnerServiceSMOImpl.queryPurchaseApplyAndDetails(purchaseApplyDto); |
| | | for (PurchaseApplyDto applyDto : purchaseApplyDtos){ |
| | | List<PurchaseApplyDetailVo> purchaseApplyDetailVos = applyDto.getPurchaseApplyDetailVo(); |
| | | for (PurchaseApplyDetailVo applyDetailVo : purchaseApplyDetailVos) { |
| | | if (applyDetailVo.getShId() != null && assetInventoryPo.getShId() != null && applyDetailVo.getShId().equals(assetInventoryPo.getShId())) { |
| | | String resOrderType = applyDto.getResOrderType().equals("10000")? "入库":"出库"; |
| | | throw new CmdException("盘存失败"+applyDetailVo.getShName() + "有"+ resOrderType +"物品"); |
| | | } |
| | | } |
| | | } |
| | | AllocationStorehouseDto allocationStorehouseDto = new AllocationStorehouseDto(); |
| | | allocationStorehouseDto.setShIda(assetInventoryPo.getShId()); |
| | | allocationStorehouseDto.setState(allocationStorehouseDto.STATE_AUDIT); |
| | | List<AllocationStorehouseDto> allocationStorehouseDtosa = allocationStorehouseInnerServiceSMOImpl.queryAllocationStorehouses(allocationStorehouseDto); |
| | | if (allocationStorehouseDtosa.size() > 0){ |
| | | //cmdDataFlowContext.setResponseEntity(ResultVo.error("盘存失败"+assetInventoryPo.getShName() + "有调拨物品。" )); |
| | | throw new CmdException("盘存失败"+assetInventoryPo.getShName() + "有调拨物品。"); |
| | | } |
| | | allocationStorehouseDto.setShIdz(assetInventoryPo.getShId()); |
| | | allocationStorehouseDtosa = allocationStorehouseInnerServiceSMOImpl.queryAllocationStorehouses(allocationStorehouseDto); |
| | | if (allocationStorehouseDtosa.size() > 0){ |
| | | //cmdDataFlowContext.setResponseEntity(ResultVo.error("盘存失败"+assetInventoryPo.getShName() + "有调拨物品。" )); |
| | | throw new CmdException("盘存失败"+assetInventoryPo.getShName() + "有调拨物品。"); |
| | | } |
| | | // PurchaseApplyDto purchaseApplyDto = new PurchaseApplyDto(); |
| | | // purchaseApplyDto.setCommunityId(assetInventoryPo.getCommunityId()); |
| | | // purchaseApplyDto.setState(purchaseApplyDto.STATE_DEALING);//审核中 |
| | | // List<PurchaseApplyDto> purchaseApplyDtos = purchaseApplyInnerServiceSMOImpl.queryPurchaseApplyAndDetails(purchaseApplyDto); |
| | | // for (PurchaseApplyDto applyDto : purchaseApplyDtos){ |
| | | // List<PurchaseApplyDetailVo> purchaseApplyDetailVos = applyDto.getPurchaseApplyDetailVo(); |
| | | // for (PurchaseApplyDetailVo applyDetailVo : purchaseApplyDetailVos) { |
| | | // if (applyDetailVo.getShId() != null && assetInventoryPo.getShId() != null && applyDetailVo.getShId().equals(assetInventoryPo.getShId())) { |
| | | // String resOrderType = applyDto.getResOrderType().equals("10000")? "入库":"出库"; |
| | | // throw new CmdException("盘存失败"+applyDetailVo.getShName() + "有"+ resOrderType +"物品"); |
| | | // } |
| | | // } |
| | | // } |
| | | // AllocationStorehouseDto allocationStorehouseDto = new AllocationStorehouseDto(); |
| | | // allocationStorehouseDto.setShIda(assetInventoryPo.getShId()); |
| | | // allocationStorehouseDto.setState(allocationStorehouseDto.STATE_AUDIT); |
| | | // List<AllocationStorehouseDto> allocationStorehouseDtosa = allocationStorehouseInnerServiceSMOImpl.queryAllocationStorehouses(allocationStorehouseDto); |
| | | // if (allocationStorehouseDtosa.size() > 0){ |
| | | // //cmdDataFlowContext.setResponseEntity(ResultVo.error("盘存失败"+assetInventoryPo.getShName() + "有调拨物品。" )); |
| | | // throw new CmdException("盘存失败"+assetInventoryPo.getShName() + "有调拨物品。"); |
| | | // } |
| | | // allocationStorehouseDto.setShIdz(assetInventoryPo.getShId()); |
| | | // allocationStorehouseDtosa = allocationStorehouseInnerServiceSMOImpl.queryAllocationStorehouses(allocationStorehouseDto); |
| | | // if (allocationStorehouseDtosa.size() > 0){ |
| | | // //cmdDataFlowContext.setResponseEntity(ResultVo.error("盘存失败"+assetInventoryPo.getShName() + "有调拨物品。" )); |
| | | // throw new CmdException("盘存失败"+assetInventoryPo.getShName() + "有调拨物品。"); |
| | | // } |
| | | |
| | | //保存盘点 产品 |
| | | if (!reqJson.containsKey("resourceStores")) { |