Browse Source

面辅料修改

huxy 2 years ago
parent
commit
79a887086c

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

@@ -65,6 +65,8 @@ import org.jeecg.modules.splfi.entity.SyPackingListFabric;
 import org.jeecg.modules.splfi.vo.SyPackingListFabricPage;
 import org.jeecg.modules.splfi.service.ISyPackingListFabricService;
 import org.jeecg.modules.splfi.service.ISyPackingListFabricItemService;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -1061,6 +1063,131 @@ public class SyPackingListFabricController {
 		 return result;
 	 }
 
+
+/*
+	 public void execute(JobExecutionContext context) throws JobExecutionException {
+		 String [] ids=new String[10];//修改调整
+		 String message2="";
+		 for (int i=0; i<ids.length;i++){
+			 try {
+				 String id=ids[i];
+				 Map<String,Object> map=new HashMap<>();
+				 SyPackingListFabric main=syPackingListFabricService.getById(id);
+				 if(main.getIsReference()==0){
+					 message2="请先做托书再推送";
+				 }
+				 Map<String,Object> mapdate=syPackingListTailoringService.getSyShippingOrder(id);
+				 if(mapdate!=null){
+					 if(!mapdate.containsKey("e4")||mapdate.get("e4").equals("0")){
+						 message2="请先提交托书再推送";
+					 }
+					 if(mapdate.containsKey("e1")&&mapdate.get("e1")!=null){
+						 main.setTheFinalShippingDate(mapdate.get("e1").toString());
+					 }else{
+						 message2="请先维护最终船期再推送";
+					 }
+					 if(mapdate.containsKey("e2")&&mapdate.get("e2")!=null){
+						 main.setTheFinalShippingDate2(mapdate.get("e2").toString());
+					 }
+					 if(mapdate.containsKey("e3")&&mapdate.get("e3")!=null){
+						 main.setLatestDateOfShipment2(mapdate.get("e3").toString());
+					 }else{
+						 message2="请先维护装运期限再推送";
+					 }
+				 }
+			 */
+/*if(main.getRecordingStatus()!=null&&main.getRecordingStatus()==1){
+				 message2="数据在推送中,请不要重复点击";
+			 }else{
+				 main.setRecordingStatus(1);
+				 syPackingListFabricService.updateById(main);//修改成衣
+			 }*//*
+
+				 List<SyPackingListFabricItem> items=syPackingListFabricItemService.selectByMainId3(id);
+				 String message="";//获取报错消息
+				 String account="";//当前账套
+				 if(items!=null){
+
+					 //SyOrderData syOrderData=syOrderDataMapper.selectById(items.get(0).getSyOrderDataId());//最终客户
+					 SyOrderData syOrderData=syOrderDataMapper.selectById(items.get(0).getSyOrderDataId());//最终客户
+					 if(syOrderData!=null){
+						 main.setEndCustomer(syOrderData.getEndCustomer());
+						 System.out.println("最终客户\t"+syOrderData.getEndCustomer());
+					 }
+					 if(syOrderData.getFlag()==1){
+						 message2="手工匹配订单不能推送";
+					 }
+					 if(message2.length()>1){
+						 main.setRecordingError(message2);//报错原因
+						 main.setPushState("2");//推送失败
+						 main.setRecordingStatus(0);//改成未推送
+						 syPackingListFabricService.updateById(main);
+						 continue;//本次不循环
+					 }
+					 SyOrderDataItem syOrderDataItem=syOrderDataItemMapper.selectById(items.get(0).getSyOrderDataItemId());//供应商全称
+					 if(syOrderDataItem!=null){
+						 main.setSupplierCode(syOrderDataItem.getSupplierCode());
+						 System.out.println("客户编码\t"+syOrderDataItem.getSupplierCode());
+					 }
+
+					 main.setSyPackingListFabricItem(items);
+					 map.put("account",items.get(0).getOmpoAccount());//委外采购账套号
+					 String venCode=syPackingListTailoringService.getDictValue(main.getGarmentFactory());//根据成衣工厂获取仓库编码
+					 if(venCode!=null){
+						 map.put("vencode",venCode);//委外采购账套号
+					 }
+					 map.put("account1",items.get(0).getOmpoAccount());//委外采购账套号
+					 map.put("ompoId",items.get(0).getOmpoId());//采购委外主表id
+					 map.put("mpOrder",items.get(0).getPurOrSubOrder());//采购委外订单号
+					 map.put("customerCode","one");//客户编码
+					 map.put("CVENCODE","one");//供应商编码
+					 map.put("orderNumber","one");//销售订单号
+					 map.put("poid","one");//销售订单id
+					 for (int x=0;x<3;x++){//最多循环3次
+						 try {
+							 if (map.get("account").equals("103")){
+								 account="103";
+								 message+=syPackingListFabricService.three(main,map)+";";
+							 }else if(map.get("account").equals("102")){
+								 account="102";
+								 message+=syPackingListFabricService.two(main,map)+";";
+							 }else if(map.get("account").equals("101")){
+								 account="101";
+								 message+=syPackingListFabricService.one(main,map)+";";
+							 }else{
+								 // 业务员,克重,包装方式,处理方式,是否手册纱,手册纱占比,尺码
+								 break;
+							 }
+						 }catch (Exception e){
+							 e.printStackTrace();
+							 message+=e.getMessage();
+							 if(map.get("account").equals(account)){
+								 break;
+							 }
+						 }
+					 }
+				 }
+				 System.out.println("message\t"+message);
+				 //if(message!=null&&message.length()>0&&(message.indexOf("接口")>-1||message.indexOf("账套")>-1)){
+				 if(message!=null&&message.length()>0&&message.indexOf("接口")>-1){
+					 main.setPushState("2");//推送失败!
+					 main.setRecordingError(message);
+				 }else if(message.indexOf("成功")>-1) {
+					 main.setPushState("1");//推送成功!
+					 main.setRecordingError("");
+				 }else{
+					 main.setPushState("2");//推送失败!
+					 main.setRecordingError(message);
+				 }
+				 main.setRecordingStatus(2);
+				 syPackingListFabricService.updateById(main);//修改成衣
+			 }catch (Exception e){
+				 e.printStackTrace();
+			 }
+		 }
+	 }
+*/
+
 	 @AutoLog(value = "装箱单面辅料批量推送u8")
 	 @ApiOperation(value="装箱单面辅料批量推送u8", notes="装箱单面辅料批量推送u8")
 	 @GetMapping(value = "/pushBatch2")
@@ -1075,8 +1202,12 @@ public class SyPackingListFabricController {
 		 UpdateWrapper updateWrapper=new UpdateWrapper();
 		 updateWrapper.set("push_State","3");
 		 updateWrapper.set("recording_Status",1);//推送中
+		 updateWrapper.ne("push_State","4");//不等于4
 		 updateWrapper.in("id",ids);
 		 syPackingListFabricService.update(updateWrapper);
+//		 result.setSuccess(true);
+//		 result.setMessage("已将"+ids.length+"条数据,调整为推送中");
+//		 return result;
 		 String message2="";
 		 for (int i=0; i<ids.length;i++){
 			 try {
@@ -1105,12 +1236,12 @@ public class SyPackingListFabricController {
 						 message2="请先维护装运期限再推送";
 					 }
 				 }
-			 /*if(main.getRecordingStatus()!=null&&main.getRecordingStatus()==1){
-				 message2="数据在推送中,请不要重复点击";
-			 }else{
-				 main.setRecordingStatus(1);
-				 syPackingListFabricService.updateById(main);//修改成衣
-			 }*/
+				 /*if(main.getRecordingStatus()!=null&&main.getRecordingStatus()==1){
+					 message2="数据在推送中,请不要重复点击";
+				 }else{
+					 main.setRecordingStatus(1);
+					 syPackingListFabricService.updateById(main);//修改成衣
+				 }*/
 				 List<SyPackingListFabricItem> items=syPackingListFabricItemService.selectByMainId3(id);
 				 String message="";//获取报错消息
 				 String account="";//当前账套

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

@@ -1276,7 +1276,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 					//map5.put("CGLTYPE","委外订单");//来源单据类型
 					map6.put("CGLTYPE","销售出库单");//来源单据类型
 				}else{
-					mapt.put("ordertype","委外");
+					mapt.put("ordertype","采购");
 					if(mapt.get("orderNumber").equals("one")){
 						orderData=syPackingListTailoringMapper.getOmOrPo("PO_POMAIN","cPOID='"+mapt.get("mpOrder")+"'","POID");//委外订单号判断 第一次
 					}else{
@@ -1691,17 +1691,19 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 				switch (maps.get(account).get("index")){
 					case "1":	//代表已完成第一道
 						//JSONObject jsonObject1=resturn1.getJSONObject(0);//采购入库单
-						String purchaseinName=maps.get(account).get("code");//获取销售发货
+						String purchaseinName=maps.get(account).get("code");//获取采购入库
 						//String purchaseinName=jsonObject1.get("U8ReceiptNo").toString();//获取销售发货单
 						List<Map<String,Object>> purchaseinMaps= syPackingListTailoringMapper.getRdRecord01(purchaseinName);
 						if(purchaseinMaps!=null){
 							for (Map map : purchaseinMaps){
 								JSONObject jsonObject=mapList5.getJSONObject(0);//循环迭代
 								List<Map<String,Object>> mapItems5= (List<Map<String,Object>>) jsonObject.get("DETAILList");
+								List<Object> ids=new ArrayList<>();
 								for (Map itemMap5 :  mapItems5){
 									if((Double.parseDouble( itemMap5.get("IQUANTITY").toString())
-											==Double.parseDouble( map.get("iQuantity").toString()))&&!itemMap5.containsKey("AUTOID_PO")){//根据尺码判断
+											==Double.parseDouble( map.get("iQuantity").toString()))&&!itemMap5.containsKey("AUTOID_PO")&&!ids.contains(map.get("AutoID"))){//根据尺码判断
 										//getcFree((JSONObject) itemMap5,map);
+										ids.add(map.get("AutoID"));
 										itemMap5.put("AUTOID_PO",map.get("AutoID"));
 									}
 								}
@@ -1736,10 +1738,12 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 							for (Map map : consignmentMaps){
 								JSONObject jsonObject=mapList4.getJSONObject(0);//循环迭代
 								List<Map<String,Object>> mapItems4= (List<Map<String,Object>>) jsonObject.get("DETAILList");
+								List<Object> ids=new ArrayList<>();
 								for (Map itemMap4 :  mapItems4){
 									/*itemMap4.get("size").equals(map.get("cFree2"))&& */
 									if((Double.parseDouble( itemMap4.get("IQUANTITY").toString())==Double.parseDouble( map.get("iQuantity").toString()))
-									&& !itemMap4.containsKey("AUTOID_SO")){
+									&& !itemMap4.containsKey("AUTOID_SO")&&!ids.contains(map.get("iDLsID"))){
+										ids.add(map.get("iDLsID"));
 										getcFree((JSONObject) itemMap4,map);
 										itemMap4.put("AUTOID_SO",map.get("iDLsID"));
 									}
@@ -1764,10 +1768,13 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 							for (Map map : saleoutMaps){
 								JSONObject jsonObject=mapList6.getJSONObject(0);//循环迭代
 								List<Map<String,Object>> mapItems6= (List<Map<String,Object>>) jsonObject.get("DETAILList");
+								List<Object> ids=new ArrayList<>();
 								for (Map itemMap6 :  mapItems6){
 									itemMap6.put("DISAUTOIDCOL","AUTOID");
 									//itemMap6.get("size").equals(map.get("cFree2"))&&
-									if((Double.parseDouble( itemMap6.get("IQUANTITY").toString()) ==Double.parseDouble( map.get("iQuantity").toString()))&&!itemMap6.containsKey("AUTOID_DIS")){
+									if((Double.parseDouble( itemMap6.get("IQUANTITY").toString()) ==Double.parseDouble( map.get("iQuantity").toString()))
+											&&!itemMap6.containsKey("AUTOID_DIS")&&!ids.contains(map.get("autoid"))){
+										ids.add(map.get("autoid"));
 										itemMap6.put("AUTOID_DIS",map.get("autoid"));
 									}
 								}
@@ -1795,9 +1802,11 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 			for (Map map : purchaseinMaps){
 				JSONObject jsonObject=mapList5.getJSONObject(0);//循环迭代
 				List<Map<String,Object>> mapItems5= (List<Map<String,Object>>) jsonObject.get("DETAILList");
+				List<Object> ids=new ArrayList<>();
 				for (Map itemMap5 :  mapItems5){
 					if((Double.parseDouble( itemMap5.get("IQUANTITY").toString())
-							==Double.parseDouble( map.get("iQuantity").toString()))&&!itemMap5.containsKey("AUTOID_PO")){//根据尺码判断
+							==Double.parseDouble( map.get("iQuantity").toString()))&&!itemMap5.containsKey("AUTOID_PO")&&!ids.contains(map.get("AutoID"))){//根据尺码判断
+						ids.add(map.get("AutoID"));
 						//getcFree((JSONObject) itemMap5,map);
 						itemMap5.put("AUTOID_PO",map.get("AutoID"));
 					}
@@ -1832,9 +1841,11 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 			for (Map map : consignmentMaps){
 				JSONObject jsonObject=mapList4.getJSONObject(0);//循环迭代
 				List<Map<String,Object>> mapItems4= (List<Map<String,Object>>) jsonObject.get("DETAILList");
+				List<Object> ids=new ArrayList<>();
 				for (Map itemMap4 :  mapItems4){
 					if((Double.parseDouble( itemMap4.get("IQUANTITY").toString())
-							==Double.parseDouble( map.get("iQuantity").toString()))&&!itemMap4.containsKey("AUTOID_PO")){//根据尺码判断
+							==Double.parseDouble( map.get("iQuantity").toString()))&&!itemMap4.containsKey("AUTOID_PO")&&!ids.contains(map.get("iDLsID"))){//根据尺码判断
+						ids.add(map.get("iDLsID"));
 						getcFree((JSONObject) itemMap4,map);
 						itemMap4.put("AUTOID_SO",map.get("iDLsID"));
 					}
@@ -1861,10 +1872,12 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 			for (Map map : saleoutMaps){
 				JSONObject jsonObject=mapList6.getJSONObject(0);//循环迭代
 				List<Map<String,Object>> mapItems6= (List<Map<String,Object>>) jsonObject.get("DETAILList");
+				List<Object> ids=new ArrayList<>();
 				for (Map itemMap6 :  mapItems6){
 					itemMap6.put("DISAUTOIDCOL","AUTOID");
 					if(itemMap6.get("size").equals(map.get("cFree2"))&&(Double.parseDouble( itemMap6.get("IQUANTITY").toString())
-							==Double.parseDouble( map.get("iQuantity").toString()))&&!itemMap6.containsKey("AUTOID_DIS")){
+							==Double.parseDouble( map.get("iQuantity").toString()))&&!itemMap6.containsKey("AUTOID_DIS")&&!ids.contains(map.get("autoid"))){
+						ids.add(map.get("autoid"));
 						itemMap6.put("AUTOID_DIS",map.get("autoid"));
 					}
 				}
@@ -2287,7 +2300,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 										if(gramWeight.intValue()==0||width.intValue()==0||netWeight.intValue()==0){
 											sy1.setActualDeclaredQuantity(null);
 										}else{
-											BigDecimal meter=netWeight.multiply(gramWeight).multiply(width).divide(new BigDecimal("100000"));//米数
+											BigDecimal meter=netWeight.multiply(new BigDecimal("100000")).divide(width,2,BigDecimal.ROUND_HALF_UP).divide(gramWeight,2,BigDecimal.ROUND_HALF_UP);//米数
 											sy1.setMeter(meter);//米数
 											sy1.setActualDeclaredQuantity(sy1.getNetWeight());//获取米数
 										}

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

@@ -64,6 +64,8 @@ import org.jeecg.modules.splt.entity.SyPackingListTailoring;
 import org.jeecg.modules.splt.vo.SyPackingListTailoringPage;
 import org.jeecg.modules.splt.service.ISyPackingListTailoringService;
 import org.jeecg.modules.splt.service.ISyPackingListTailoringItemService;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -1319,6 +1321,117 @@ public class SyPackingListTailoringController {
 	 }
 
 
+	/* public void execute(JobExecutionContext context) throws JobExecutionException {
+		 String [] ids=new String[10];//修改调整
+		 String message2="";
+		 for (int i=0; i<ids.length;i++){
+			 try {
+				 String id=ids[i];
+				 SyPackingListTailoring main=syPackingListTailoringService.getById(id);
+				 if(main.getIsReference()==0){
+					 message2="请先做托书再推送";
+				 }
+				 Map<String,Object> map=new HashMap<>();
+				 Map<String,Object> mapdate=syPackingListTailoringService.getSyShippingOrder(id);
+				 //System.out.println("madate\t"+mapdate);
+				 if(mapdate!=null){
+					 if(!mapdate.containsKey("e4")||mapdate.get("e4").equals("0")){
+						 message2="请先提交托书再推送";
+					 }
+					 if(mapdate.containsKey("e1")&&mapdate.get("e1")!=null){
+						 main.setTheFinalShippingDate(mapdate.get("e1").toString());
+					 }else{
+						 message2="请先维护最终船期再推送";
+					 }
+					 if(mapdate.containsKey("e2")&&mapdate.get("e2")!=null){
+						 main.setTheFinalShippingDate2(mapdate.get("e2").toString());
+					 }
+					 if(mapdate.containsKey("e3")&&mapdate.get("e3")!=null){
+						 main.setLatestDateOfShipment2(mapdate.get("e3").toString());
+					 }else{
+						 message2="请先维护装运期限再推送";
+					 }
+				 }
+				 List<SyPackingListTailoringItem> syPackingListTailoringItems=syPackingListTailoringService.getList(main.getId());
+				 main.setSyPackingListTailoringItemList(syPackingListTailoringItems);
+				 String message="";//获取报错消息
+				 if(syPackingListTailoringItems!=null){
+					 map.put("account",main.getSyPackingListTailoringItemList().get(0).getOmpoAccount());//委外采购账套号
+					 map.put("account1",main.getSyPackingListTailoringItemList().get(0).getOmpoAccount());//委外采购账套号
+					 map.put("ompoId",main.getSyPackingListTailoringItemList().get(0).getOmpoId());//采购委外主表id
+					 SyOrderData syOrderData=syOrderDataMapper.selectById(syPackingListTailoringItems.get(0).getSyOrderDataId());//最终客户
+					 if(syOrderData!=null){
+						 main.setEndCustomer(syOrderData.getEndCustomer());
+					 }
+					 if(syOrderData.getFlag()==1){
+						 message2="手工匹配订单不能推送";
+					 }
+					 if(message2.length()>1){
+						 main.setRecordingError(message2);//报错原因
+						 main.setRecordingStatus(0);//改成未推送
+						 main.setPushState("2");//推送失败
+						 syPackingListTailoringService.updateById(main);
+						 continue;//本次不循环
+					 }
+					 *//*if(main.getRecordingStatus()!=null&&main.getRecordingStatus()==1){
+						 //message2="数据在推送中,请不要重复点击";
+					 }else{
+						 main.setRecordingStatus(1);
+						 syPackingListTailoringService.updateById(main);//修改成衣
+					 }*//*
+					 SyOrderDataItem syOrderDataItem=syOrderDataItemMapper.selectById(syPackingListTailoringItems.get(0).getSyOrderDataItemId());//供应商全称
+					 if(syOrderDataItem!=null){
+						 main.setSupplierCode(syOrderDataItem.getSupplierCode());
+					 }
+					 if(main.getPurchase()==null){
+						 map.put("mpOrder",main.getSyPackingListTailoringItemList().get(0).getSpurOrSubOrder());//采购委外订单号
+					 }else{
+						 map.put("mpOrder",main.getPurchase());//采购委外订单号
+					 }
+					 String venCode=syPackingListTailoringService.getDictValue(main.getGarmentFactory());//根据成衣工厂获取仓库编码
+					 if(venCode!=null){
+						 map.put("vencode",venCode);//委外采购账套号
+					 }
+					 map.put("customerCode","one");//客户编码
+					 map.put("CVENCODE","one");//供应商编码
+					 map.put("orderNumber","one");//销售订单号
+					 map.put("poid","one");//销售订单id
+					 for (int x=0;x<3;x++){//最多循环3次
+						 try {
+							 if (map.get("account").equals("103")){
+								 message+=syPackingListTailoringService.three(main,map);
+							 }else if(map.get("account").equals("102")){
+								 message+=syPackingListTailoringService.two(main,map);
+							 }else if(map.get("account").equals("101")){
+								 message+=syPackingListTailoringService.one(main,map);
+							 }else{
+								 break;
+							 }
+						 }catch (Exception e){
+							 e.printStackTrace();
+							 message+=e.getMessage();
+						 }
+					 }
+				 }
+				 System.out.println("message\t"+message);
+				 if(message!=null&&message.length()>0&&message.indexOf("接口")>-1){
+					 main.setPushState("2");//推送失败!
+					 main.setRecordingError(message);
+				 }else if(message.indexOf("成功")>-1){
+					 main.setPushState("1");//推送成功!
+					 main.setRecordingError("");
+				 }else{
+					 main.setPushState("2");//推送失败!
+					 main.setRecordingError(message);
+				 }
+				 main.setRecordingStatus(0);
+				 syPackingListTailoringService.updateById(main);//修改成衣
+			 }catch (Exception e){
+				 e.printStackTrace();
+			 }
+		 }
+	 }*/
+
 	 @AutoLog(value = "装箱单成衣批量推送u8")
 	 @ApiOperation(value="装箱单成衣批量推送u8", notes="装箱单成衣批量推送u8")
 	 @GetMapping(value = "/pushBatch2")
@@ -1332,9 +1445,13 @@ public class SyPackingListTailoringController {
 		 }
 		 UpdateWrapper updateWrapper=new UpdateWrapper();
 		 updateWrapper.set("push_State","3");
+		 updateWrapper.ne("push_State","4");//不等于4
 		 updateWrapper.set("recording_Status",1);//推送中
 		 updateWrapper.in("id",ids);
 		 syPackingListTailoringService.update(updateWrapper);
+		 //result.setSuccess(true);
+		 //result.setMessage("已将"+ids.length+"条数据,调整为推送中");
+		 //return result;
 		 String message2="";
 		 for (int i=0; i<ids.length;i++){
 			 try {