|
@@ -193,6 +193,107 @@ public class ContractManagementInfoServiceImpl extends ServiceImpl<ContractManag
|
|
|
public ContractManagementInfo getInfo(String id) {
|
|
|
// 主表信息
|
|
|
ContractManagementInfo contractManagementInfo = this.selectById(id);
|
|
|
+ //现货自运采购合同
|
|
|
+ if ("1".equals(contractManagementInfo.getGoodsType()) && "1".equals(contractManagementInfo.getDeliverType()) && "2".equals(contractManagementInfo.getContractType())) {
|
|
|
+ //定义出库量
|
|
|
+ Float outWeight = 0.0f;
|
|
|
+ //查询同名临时库出库量
|
|
|
+ List<WarehouseInOutInfo> warehouseInOutInfoList = warehouseInOutInfoService.selectList(new EntityWrapper<WarehouseInOutInfo>()
|
|
|
+ .eq("warehouse_name", contractManagementInfo.getContractNo())
|
|
|
+ .eq("in_out_flag", "1")
|
|
|
+ .eq("status_flag", "3")
|
|
|
+ .eq("delete_flag", "0"));
|
|
|
+ if (!CollectionUtils.isEmpty(warehouseInOutInfoList)) {
|
|
|
+ for (WarehouseInOutInfo warehouseInOutInfo : warehouseInOutInfoList) {
|
|
|
+ outWeight = outWeight + warehouseInOutInfo.getNetWeight();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //定义退库量
|
|
|
+ Float returnWeight = 0.0f;
|
|
|
+ //查询同名临时库出库量
|
|
|
+ List<WarehouseInOutInfo> warehouseInOutInfoList1 = warehouseInOutInfoService.selectList(new EntityWrapper<WarehouseInOutInfo>()
|
|
|
+ .eq("warehouse_name", contractManagementInfo.getContractNo())
|
|
|
+ .eq("in_out_type", "退库")
|
|
|
+ .eq("status_flag", "3")
|
|
|
+ .eq("delete_flag", "0"));
|
|
|
+ if (!CollectionUtils.isEmpty(warehouseInOutInfoList1)) {
|
|
|
+ for (WarehouseInOutInfo warehouseInOutInfo : warehouseInOutInfoList1) {
|
|
|
+ returnWeight = returnWeight + warehouseInOutInfo.getNetWeight();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ contractManagementInfo.setCompletedQuantity(outWeight - returnWeight);
|
|
|
+ }
|
|
|
+ //现货他运采购合同
|
|
|
+ else if ("1".equals(contractManagementInfo.getGoodsType()) && "2".equals(contractManagementInfo.getDeliverType()) && "2".equals(contractManagementInfo.getContractType())) {
|
|
|
+ //定义出库量
|
|
|
+ Float inWeight = 0.0f;
|
|
|
+ //查询同合同编号入库量
|
|
|
+ List<WarehouseInOutInfo> warehouseInOutInfoList = warehouseInOutInfoService.selectList(new EntityWrapper<WarehouseInOutInfo>()
|
|
|
+ .eq("contract_no", contractManagementInfo.getContractNo())
|
|
|
+ .eq("in_out_flag", "2")
|
|
|
+ .eq("status_flag", "3")
|
|
|
+ .eq("delete_flag", "0"));
|
|
|
+ if (!CollectionUtils.isEmpty(warehouseInOutInfoList)) {
|
|
|
+ for (WarehouseInOutInfo warehouseInOutInfo : warehouseInOutInfoList) {
|
|
|
+ inWeight = Float.valueOf(inWeight) + warehouseInOutInfo.getNetWeight();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ contractManagementInfo.setCompletedQuantity(inWeight);
|
|
|
+ }
|
|
|
+ //销售合同
|
|
|
+ else {
|
|
|
+ //定义出库量
|
|
|
+ Float outWeight = 0.0f;
|
|
|
+ //查询同合同编号出库量
|
|
|
+ List<WarehouseInOutInfo> warehouseInOutInfoList = warehouseInOutInfoService.selectList(new EntityWrapper<WarehouseInOutInfo>()
|
|
|
+ .eq("contract_no", contractManagementInfo.getContractNo())
|
|
|
+ .eq("in_out_flag", "1")
|
|
|
+ .eq("status_flag", "3")
|
|
|
+ .eq("delete_flag", "0"));
|
|
|
+ if (!CollectionUtils.isEmpty(warehouseInOutInfoList)) {
|
|
|
+ for (WarehouseInOutInfo warehouseInOutInfo : warehouseInOutInfoList) {
|
|
|
+ outWeight = outWeight + warehouseInOutInfo.getNetWeight();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //定义运输损耗
|
|
|
+ Float loss = 0.0f;
|
|
|
+ //查询同合同编号的运输任务
|
|
|
+ TranTaskInfo tranTaskInfo = tranTaskInfoService.selectOne(new EntityWrapper<TranTaskInfo>()
|
|
|
+ .eq("contract_no", contractManagementInfo.getContractNo())
|
|
|
+ .eq("delete_flag", "0"));
|
|
|
+ if (tranTaskInfo != null) {
|
|
|
+ //定义装车净重
|
|
|
+ Float loadNetWeight = 0.0f;
|
|
|
+ //定义卸车净重
|
|
|
+ Float unloadNetWeight = 0.0f;
|
|
|
+ //查询运输车辆
|
|
|
+ List<TranCarInfo> tranCarInfoList = tranCarInfoService.selectList(new EntityWrapper<TranCarInfo>()
|
|
|
+ .eq("info_id", tranTaskInfo.getId())
|
|
|
+ .eq("status_flag", "1")
|
|
|
+ .eq("delete_flag", "0"));
|
|
|
+ if (!CollectionUtils.isEmpty(tranCarInfoList)) {
|
|
|
+ for (TranCarInfo tranCarInfo : tranCarInfoList) {
|
|
|
+ loadNetWeight = loadNetWeight + tranCarInfo.getLoadNetWeight();
|
|
|
+ unloadNetWeight = unloadNetWeight + tranCarInfo.getUnloadNetWeight();
|
|
|
+ }
|
|
|
+ loss = loadNetWeight - unloadNetWeight;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //定义退库量
|
|
|
+ Float returnWeight = 0.0f;
|
|
|
+ //查询同合同编号出库量
|
|
|
+ List<WarehouseInOutInfo> warehouseInOutInfoList1 = warehouseInOutInfoService.selectList(new EntityWrapper<WarehouseInOutInfo>()
|
|
|
+ .eq("contract_no", contractManagementInfo.getContractNo())
|
|
|
+ .eq("in_out_type", "退库")
|
|
|
+ .eq("status_flag", "3")
|
|
|
+ .eq("delete_flag", "0"));
|
|
|
+ if (!CollectionUtils.isEmpty(warehouseInOutInfoList1)) {
|
|
|
+ for (WarehouseInOutInfo warehouseInOutInfo : warehouseInOutInfoList1) {
|
|
|
+ returnWeight = returnWeight + warehouseInOutInfo.getNetWeight();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ contractManagementInfo.setCompletedQuantity(outWeight - loss - returnWeight);
|
|
|
+ }
|
|
|
//货物信息
|
|
|
ContractGoodsInfo contractGoodsInfo = contractGoodsInfoService.selectOne(new EntityWrapper<ContractGoodsInfo>().eq(ContractGoodsInfo.QueryFiles.CONTRACT_ID, id));
|
|
|
//流程信息
|
|
@@ -669,7 +770,7 @@ public class ContractManagementInfoServiceImpl extends ServiceImpl<ContractManag
|
|
|
cell.setCellValue("重量(吨)");
|
|
|
cell.setCellStyle(styleDetail);
|
|
|
cell = row1.createCell(6);
|
|
|
- cell.setCellValue("合同单价");
|
|
|
+ cell.setCellValue("合同单价(元)");
|
|
|
cell.setCellStyle(styleDetail);
|
|
|
cell = row1.createCell(7);
|
|
|
cell.setCellValue("包装方式");
|