Browse Source

成衣参照bug

huxy 1 year ago
parent
commit
4f63ccdca0

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splfi/controller/SyPackingListFabricController.java

@@ -839,7 +839,7 @@ public class SyPackingListFabricController {
 			 Workbook workbook = ExcelExportUtil.exportExcelClone(maps,templateExcelConstants);
 			// Workbook workbook = ExcelExportUtil.exportExcel(maps,templateExcelConstants);
 			 for(int i=0;i<count;i++){
-				 workbook.setSheetName(i,packingListFabrics.get(i).getContainerNumber()+"-"+packingListFabrics.get(i).getExportInvoiceNo());
+				 workbook.setSheetName(i,packingListFabrics.get(count-1-i).getContainerNumber()+"-"+packingListFabrics.get(count-1-i).getExportInvoiceNo());
 			 }
 			 //匹数 毛重 净重 体积 实际报关数量 单价 金额
 			 //refreshSheet(workbook,temps);//配置某列数据

+ 134 - 29
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splfi/service/impl/SyPackingListFabricServiceImpl.java

@@ -90,7 +90,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 	private IDxpDataPlanService dxpDataPlanService;
 
 	/**
-	 * 添加
+	 * 通过参照出运明细添加数据  添加方式1
 	 * @param syPackingListFabric
 	 * @return
 	 */
@@ -122,9 +122,9 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 			SyShippingDetailsItem detailsItem=syShippingDetailsItemMapper.selectById(entity.getSyShippingDetailsItemId());
 			//detailsItem.setIsReference(1);//修改成已被参照
 			//剩余数量-这次入库数量=新剩余数量
-			detailsItem.setSurplusQuantity(detailsItem.getSurplusQuantity().subtract(entity.getInventoryQuantity()));
+			detailsItem.setOrderRemainingQuantity(detailsItem.getOrderRemainingQuantity().subtract(entity.getInventoryQuantity()));
 			//此次入库数量-剩余数量=超发数量
-			detailsItem.setExcessQuantity(entity.getInventoryQuantity().subtract(detailsItem.getSurplusQuantity()));
+			detailsItem.setExcessQuantity(entity.getInventoryQuantity().subtract(detailsItem.getOrderRemainingQuantity()));
 			detailsItem.setIsReference(2);//面辅料回写
 			entity.setSalesman(detailsItem.getSalesman());//获取业务员
 			entity.setSalesDepartment(detailsItem.getSalesDepartment());//获取业务部门
@@ -171,7 +171,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 	}
 
 	/**
-	 *
+	 * 增删改都会调用的方法,用来计算剩余数量和超发数量
 	 * @param quantity 本次数量
 	 * @param syShippingDetailsItemId 出运明细id
 	 * @return
@@ -181,7 +181,10 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 		queryWrapper.eq("sy_shipping_details_item_id", syShippingDetailsItemId);//出运明细id
 		queryWrapper.eq("del_flag", "0");//未删除
 		queryWrapper.select("sum(actual_Declared_Quantity) as actualDeclaredQuantity");//获取实际报关数量合计
-		BigDecimal actualDeclaredQuantity=syPackingListFabricItemMapper.selectOne(queryWrapper).getActualDeclaredQuantity();
+		BigDecimal actualDeclaredQuantity=new BigDecimal("0");
+		if(syPackingListFabricItemMapper.selectOne(queryWrapper)!=null){
+			actualDeclaredQuantity=syPackingListFabricItemMapper.selectOne(queryWrapper).getActualDeclaredQuantity();
+		}
 		actualDeclaredQuantity.add(quantity);
 
 		QueryWrapper queryWrapper2=new QueryWrapper();
@@ -194,9 +197,9 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 		BigDecimal excessQuantity=null;//超发数量
 		if(actualDeclaredQuantity.doubleValue()>shipmentQuantity.doubleValue()){
 			excessQuantity=actualDeclaredQuantity.subtract(shipmentQuantity);
-		}
-		if(excessQuantity.doubleValue()<=0){
-			excessQuantity=null;//转为null
+			if(excessQuantity.doubleValue()<=0){
+				excessQuantity=null;//转为null
+			}
 		}
 		UpdateWrapper updateWrapper=new UpdateWrapper();
 		updateWrapper.set("remaining_Quantity",remainingQuantity);
@@ -205,6 +208,12 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 		return syPackingListFabricItemMapper.update(null,updateWrapper);
 	}
 
+	/**
+	 * 通过主页的编辑来修改数据
+	 * @param syPackingListFabric
+	 * @param syPackingListFabricItemList
+	 * @return
+	 */
 	@Override
 	@Transactional
 	public SyPackingListFabric updateMain(SyPackingListFabric syPackingListFabric,List<SyPackingListFabricItem> syPackingListFabricItemList) {
@@ -242,9 +251,9 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 				//因为云工场得修改时得停止调用前面接口
 				/*SyShippingDetailsItem s1 =syShippingDetailsItemMapper.selectById(entity.getSyShippingDetailsItemId());
 				//剩余数量-这次入库数量=新剩余数量
-				s1.setSurplusQuantity(s1.getSurplusQuantity().subtract(entity.getInventoryQuantity()));
+				s1.setOrderRemainingQuantity(s1.getOrderRemainingQuantity().subtract(entity.getInventoryQuantity()));
 				//此次入库数量-剩余数量=超发数量
-				s1.setExcessQuantity(entity.getInventoryQuantity().subtract(s1.getSurplusQuantity()));
+				s1.setExcessQuantity(entity.getInventoryQuantity().subtract(s1.getOrderRemainingQuantity()));
 				syShippingDetailsItemMapper.updateById(s1);
 				entity.setTotalPrice(entity.getActualDeclaredQuantity().multiply(entity.getPrice()));//实际报关数量*单价
 				if((entity.getInventoryCcode().indexOf("03")!=-1&&!entity.getInventoryCcode().equals("0399")) ||
@@ -272,6 +281,10 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 		return syPackingListFabric;
 	}
 
+	/**
+	 * 删除 将del_flag改为1
+	 * @param id
+	 */
 	@Override
 	@Transactional
 	public void delMain(String id) {
@@ -285,6 +298,10 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 		syPackingListFabricMapper.deleteByMainId(id);
 	}
 
+	/**
+	 * 批量删除 将del_flag改为1
+	 * @param idList
+	 */
 	@Override
 	@Transactional
 	public void delBatchMain(Collection<? extends Serializable> idList) {
@@ -300,11 +317,22 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 		}
 	}
 
+	/**
+	 * 根据条件查询发运明细
+	 * @param page
+	 * @param queryWrapper
+	 * @return
+	 */
 	@Override
 	public IPage<SyShippingDetailsVo> queryShippingDetails(IPage<SyShippingDetailsVo> page, QueryWrapper<SyShippingDetailsVo> queryWrapper) {
 		return syPackingListFabricMapper.queryShippingDetails(page,queryWrapper);//查询发运明细
 	}
 
+	/**
+	 * 暂时没用到
+	 * @param ids
+	 * @return
+	 */
 	@Override
 	public  List<SyPackingListFabric> getSyShippingDetailsDatas(String[] ids) {
 /*		SyPackingListFabric syPackingListFabricList=syPackingListFabricMapper.getSyShippingDetailsData(ids);
@@ -318,7 +346,13 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 	}
 
 
-	//可能会获取多条数据头表数据,头表不知选那条数据
+	/**
+	 * 选中出运明细后,根据主表id和分组id查询出对应的数据
+	 * @param ids
+	 * @param groupIds
+	 * @return
+	 * @throws ParseException
+	 */
 	@Override
 	public  SyPackingListFabric getSyShippingDetailsData(String[] ids,String [] groupIds) throws ParseException {
 		String time= new SimpleDateFormat("yyyy-MM-dd").format(System.currentTimeMillis());
@@ -341,6 +375,11 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 		return syPackingListFabric;
 	}
 
+	/**
+	 * 根据主表id查询该单据的所有数据
+	 * @param id
+	 * @return
+	 */
 	@Override
 	public SyPackingListFabric selectById(String id) {
 		SyPackingListFabric syPackingListFabric= syPackingListFabricMapper.selectById(id);
@@ -348,7 +387,13 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 		return syPackingListFabric;
 	}
 
-	//面辅料导出,集装箱号、外销发票号相同进行合并
+
+	/**
+	 * 面辅料导出,集装箱号、外销发票号相同合并为sheetName
+	 * @param page
+	 * @param queryWrapper
+	 * @return
+	 */
 	@Override
 	public List<SyPackingListFabric> selectByList(IPage<SyPackingListFabric> page,QueryWrapper<SyPackingListFabric> queryWrapper) {
 		 //传搜索条件
@@ -389,12 +434,22 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 		return arrayLists;
 	}
 
-	//主页查询
+	/**
+	 * 分页查询
+	 * @param page
+	 * @param queryWrapper
+	 * @return
+	 */
 	@Override
 	public IPage<SyPackingListFabric> selectPage(IPage<SyPackingListFabric> page, QueryWrapper<SyPackingListFabric> queryWrapper) {
 		return syPackingListFabricMapper.queryMain(page,queryWrapper);
 	}
 
+	/**
+	 * 批量提交
+	 * @param ids
+	 * @return
+	 */
 	@Override
 	@Transactional
 	public boolean submitBatch(String[] ids) {
@@ -414,6 +469,11 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 		}
 	}
 
+	/**
+	 * 批量取消提交
+	 * @param ids
+	 * @return
+	 */
 	@Override
 	@Transactional
 	public String cancelSubmitBatch(String[] ids) {
@@ -446,7 +506,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 	}
 
 	/***
-	 * 云工厂
+	 * 云工厂推送过来的接口 添加方式2
 	 * @param syPackingListTailorings
 	 */
 	@Override
@@ -467,8 +527,6 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 			syPackingListFabric.setStatus("0");
 			syPackingListFabric.setDelFlag("0");
 			syPackingListFabricMapper.insert(syPackingListFabric);
-			//客户名
-			//客户简称
 			for (SyPackingListFabricItem s1 : syPackingListFabric.getSyPackingListFabricItem()) {
 				s1.setId(null);
 				s1.setDelFlag("0");
@@ -530,10 +588,10 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 					s1.setSpecificationAndModel(item.getSpecificationAndModel());//规格型号
 
 					if(s1.getActualDeclaredQuantity()!=null){
-						s1.setExcessQuantity(s1.getActualDeclaredQuantity().subtract(item.getSurplusQuantity()));//超发数量
-						s1.setSurplusQuantity(item.getSurplusQuantity().subtract(s1.getActualDeclaredQuantity()).intValue());//剩余数量
-						item.setExcessQuantity(s1.getActualDeclaredQuantity().subtract(item.getSurplusQuantity()));
-						item.setSurplusQuantity(item.getSurplusQuantity().subtract(s1.getActualDeclaredQuantity()));
+						s1.setExcessQuantity(s1.getActualDeclaredQuantity().subtract(item.getOrderRemainingQuantity()));//超发数量
+						s1.setRemainingQuantity(item.getOrderRemainingQuantity().subtract(s1.getActualDeclaredQuantity()));//剩余数量
+						item.setExcessQuantity(s1.getActualDeclaredQuantity().subtract(item.getOrderRemainingQuantity()));
+						item.setOrderRemainingQuantity(item.getOrderRemainingQuantity().subtract(s1.getActualDeclaredQuantity()));
 						updateQuantity(s1.getActualDeclaredQuantity(),s1.getSyShippingDetailsItemId());
 					}
 					item.setIsReference(2);
@@ -554,7 +612,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 	}
 
 	/**
-	 * excel导入
+	 * excel导入 添加方式3
 	 * @param maps
 	 * @return
 	 */
@@ -639,10 +697,10 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 
 					}
 					if(item.getActualDeclaredQuantity()!=null){//计算超发和剩余数量
-						item.setExcessQuantity(item.getActualDeclaredQuantity().subtract(syShippingDetailsItem.getSurplusQuantity()));//超发数量
-						item.setSurplusQuantity(syShippingDetailsItem.getSurplusQuantity().subtract(item.getActualDeclaredQuantity()).intValue());//剩余数量
-						syShippingDetailsItem.setExcessQuantity(item.getActualDeclaredQuantity().subtract(syShippingDetailsItem.getSurplusQuantity()));
-						syShippingDetailsItem.setSurplusQuantity(syShippingDetailsItem.getSurplusQuantity().subtract(item.getActualDeclaredQuantity()));
+						item.setExcessQuantity(item.getActualDeclaredQuantity().subtract(syShippingDetailsItem.getOrderRemainingQuantity()));//超发数量
+						item.setRemainingQuantity(syShippingDetailsItem.getOrderRemainingQuantity().subtract(item.getActualDeclaredQuantity()));//剩余数量
+						syShippingDetailsItem.setExcessQuantity(item.getActualDeclaredQuantity().subtract(syShippingDetailsItem.getOrderRemainingQuantity()));
+						syShippingDetailsItem.setOrderRemainingQuantity(syShippingDetailsItem.getOrderRemainingQuantity().subtract(item.getActualDeclaredQuantity()));
 						syShippingDetailsItem.setIsReference(2);//回写
 						syShippingDetailsItemMapper.updateById(syShippingDetailsItem);
 						updateQuantity(item.getActualDeclaredQuantity(),item.getSyShippingDetailsItemId());
@@ -660,6 +718,11 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 		return bool;
 	}
 
+	/**
+	 * excel导入测试的数据
+	 * @param maps
+	 * @return
+	 */
 	@Override
 	public String excelTest(Map<String, SyPackingListFabric> maps) {
 		String strs="";
@@ -741,7 +804,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 	}
 
 	@Autowired
-	private SyPackingListTailoringMapper syPackingListTailoringMapper;
+	private SyPackingListTailoringMapper syPackingListTailoringMapper;//成衣mapper
 
 	@Autowired
 	private PurchaseWarehousingMapper purchaseWarehousingMapper;//采购入库表
@@ -765,7 +828,12 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 	}
 
 
-
+	/**
+	 * 推送u8
+	 * @param main
+	 * @param mapt
+	 * @return
+	 */
 	String saveBatch(SyPackingListFabric main,Map<String,Object> mapt){
 		mapt.put("customerCode","xxx");//进入方法时设置客户编码为空
 		if(main==null){
@@ -1267,6 +1335,11 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 
 	}
 
+	/**
+	 * 生成txt文件
+	 * @param mapList
+	 * @param tableName
+	 */
 	public void text(JSONArray mapList,String tableName){
 		try{
 			String txtWorld="\n"+((Map)mapList.get(0)).get("CACCID")+"\t"+new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS").format(System.currentTimeMillis())+"\n\n";
@@ -1279,6 +1352,11 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 		}
 	}
 
+	/**
+	 * 记录推送u8成功的单据号
+	 * @param syPackingListTailoring
+	 * @param recording
+	 */
 	public void recording(SyPackingListFabric syPackingListTailoring,String recording){
 		if(syPackingListTailoring.getRecording()!=null){
 			String[] recordings=syPackingListTailoring.getRecording().split(",");
@@ -1305,6 +1383,11 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 		}
 	}
 
+	/**
+	 * 记录推送u8成功的单据号
+	 * @param syPackingListTailoring
+	 * @param recording
+	 */
 	public void isSucceed(SyPackingListFabric syPackingListTailoring,String recording){
 		if(syPackingListTailoring.getIsSucceed()!=null){
 			String[] recordings=syPackingListTailoring.getIsSucceed().split(",");
@@ -1331,6 +1414,15 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 		}
 	}
 
+	/**
+	 * 推送u8
+	 * @param main
+	 * @param jsonArray
+	 * @param tableName
+	 * @param account
+	 * @param index
+	 * @return
+	 */
 	public String result(SyPackingListFabric main,JSONArray jsonArray,String tableName ,String account,String index){
 		JSONObject jsonObject=jsonArray.getJSONObject(0);
 		if(jsonObject.get("Result").equals("F")){//获取发货单是否成功添加
@@ -1339,6 +1431,11 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 		return account+"-"+index+"-"+jsonObject.get("ReceiptNo");//账套号-序号-生成的单号
 	}
 
+	/**
+	 * 获取自由项
+	 * @param itemMap
+	 * @param mapPOPodetails
+	 */
 	public void getcFree(JSONObject itemMap,Map<String,Object> mapPOPodetails){
 		itemMap.put("CDEFINE22",setNull(mapPOPodetails.get("cDefine22")));
 		itemMap.put("CDEFINE23",setNull(mapPOPodetails.get("cDefine23")));
@@ -1376,6 +1473,10 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 
 	}
 
+	/**
+	 * 从u8拉取数据 添加方式4
+	 * @return
+	 */
 	//@Override
 	//@Transactional
 	@Scheduled(fixedRate=1000*60*3)
@@ -1673,10 +1774,14 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 		return "成功添加了"+num+"条数据!";
 	}
 
+	/**
+	 * 判断该字符串是否能转化为数字
+	 * @param str
+	 * @return
+	 */
 	public static boolean isNumeric(String str) {
-		String bigStr;
 		try {
-			bigStr = new BigDecimal(str).toString();
+			String bigStr = new BigDecimal(str).toString();
 		} catch (Exception e) {
 			return false;//异常 说明包含非数字。
 		}

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/controller/SyPackingListTailoringController.java

@@ -277,7 +277,7 @@ public class SyPackingListTailoringController {
 				 queryWrapper.eq("a.is_Reference","2");//已被成衣装箱单参照
 			 }
 		 }else{
-			 queryWrapper.ge("a.is_Reference","1");//未被成衣装箱单参照
+			 queryWrapper.eq("a.is_Reference","1");//未被成衣装箱单参照
 		 }
 
 		 Page<SyPreAssembledPackingListVo> page = new Page<SyPreAssembledPackingListVo>(pageNo, pageSize);

+ 6 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/service/impl/SyPackingListTailoringServiceImpl.java

@@ -131,6 +131,7 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 		SyPreAssembledPackingList syPreAssembledPackingList=syPreAssembledPackingListMapper.selectById(syPackingListTailoring.getSyPreAssembledPackingListId());//获取订单数据id
 		if(syPreAssembledPackingList!=null&&syPreAssembledPackingList.getSyOrderDataId()!=null){
 			syPackingListTailoring.setSyOrderDataId(syPackingListTailoring.getSyOrderDataId());
+
 		}
 		if(syPackingListTailoring.getSyPackingListTailoringItemList()!=null){
 			syPackingListTailoring.setTotalBoxes(new BigDecimal("0"));//总箱数
@@ -217,6 +218,8 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 		if(syPreAssembledPackingList==null){
 			throw new JeecgBootException("数据库找不到对应的预装箱单id"+syPackingListTailoring.getSyPreAssembledPackingListId());
 		}
+		syPreAssembledPackingList.setIsReference(2);
+		syPreAssembledPackingListMapper.updateById(syPreAssembledPackingList);
 		syPackingListTailoring.setContainerCode(syPreAssembledPackingList.getContainerCode());//集装箱代号
 		syPackingListTailoring.setContainerNumber(syPreAssembledPackingList.getContainerNumber());//集装箱号
 		//syPackingListTailoring.setExportInvoiceNo(syPreAssembledPackingList);//外销发票号
@@ -539,15 +542,15 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 				syPackingListTailoring.setStatus("0");//单据状态默认为0
 				syPackingListTailoring.setDocumentNo(randomStr());//单据号
 				syPackingListTailoringMapper.insert(syPackingListTailoring);//往主表添加数据
-				UpdateWrapper updateWrapper=new UpdateWrapper();
-				updateWrapper.set("is_Reference","2");//已被装箱单参照,预装箱单不能取消提交
-				updateWrapper.eq("id",syPackingListTailoring.getSyPreAssembledPackingListId());//预装箱单主表id做为修改条件
 				syPackingListTailoring.setTotal(new BigDecimal("0"));
 				syPackingListTailoring.setTotalBoxes(new BigDecimal("0"));
 				syPackingListTailoring.setTotalNetWeight(new BigDecimal("0"));
 				syPackingListTailoring.setTotalGrossWeight(new BigDecimal("0"));
 				syPackingListTailoring.setTotalVolume(new BigDecimal("0"));
 				syPackingListTailoring.setTotalPrice(new BigDecimal("0"));
+				UpdateWrapper updateWrapper=new UpdateWrapper();
+				updateWrapper.set("is_Reference","2");//已被装箱单参照,预装箱单不能取消提交
+				updateWrapper.eq("id",syPackingListTailoring.getSyPreAssembledPackingListId());//预装箱单主表id做为修改条件
 				syPreAssembledPackingListMapper.update(null,updateWrapper);//修改
 				for (SyPackingListTailoringItem item : syPackingListTailoring.getSyPackingListTailoringItemList()){
 					List<SizeTable> sizes=item.getSizeTables();//获取尺码表信息