瀏覽代碼

成本分配/预装箱单/销售订单/成衣/面辅料 bug修复

huxy 8 月之前
父節點
當前提交
ae60b5d16c

+ 6 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/controller/SyCostAllocationController.java

@@ -176,8 +176,8 @@ public class SyCostAllocationController {
                 for (int i=0;i<fabrics2.size();i++){
                     SyCostAllocationFabric fabric2=JSONObject.parseObject(String.valueOf(fabrics2.getJSONObject(i)),SyCostAllocationFabric.class);
                     for (SyCostAllocationFabric fabric1 :fabrics1){
-                        System.out.println("fabric1\t"+fabric1);
-                        System.out.println("fabric2\t"+fabric2);
+//                        System.out.println("fabric1\t"+fabric1);
+//                        System.out.println("fabric2\t"+fabric2);
                         if (fabric2.getGoodsName().equals(fabric1.getGoodsName())
                                 &&fabric2.getUsageQuantity().doubleValue()==fabric1.getUsageQuantity().doubleValue()
                                 &&fabric2.getRemarks()!=null){
@@ -197,7 +197,10 @@ public class SyCostAllocationController {
                 for (int i=0;i<ingredients2.size();i++){
                     SyCostAllocationIngredient fabric2=JSONObject.parseObject(String.valueOf(ingredients2.getJSONObject(i)),SyCostAllocationIngredient.class);
                     for (SyCostAllocationIngredient fabric1 :ingredients1){
-                        if (fabric2.getGoodsName().equals(fabric1.getGoodsName())
+                        if (    fabric1.getGoodsName()!=null&&fabric2.getGoodsName()!=null
+                                &&fabric2.getUsageQuantity()!=null&&fabric1.getUsageQuantity()!=null
+                                &&fabric2.getSupper()!=null&&fabric1.getSupper()!=null
+                                &&fabric2.getGoodsName().equals(fabric1.getGoodsName())
                                 &&fabric2.getUsageQuantity().doubleValue()==fabric1.getUsageQuantity().doubleValue()
                                 &&fabric2.getSupper().equals(fabric1.getSupper())&&fabric2.getRemarks()!=null){
                             fabric1.setRemarks(fabric2.getRemarks());

+ 37 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/mapper/xml/SyCostAllocationFabricMapper.xml

@@ -293,7 +293,7 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%'
 
 
 	<!--	面料余下数量链接方法-->
-	<select id="queryRemainingByFabric" resultType="org.jeecg.modules.cost.entity.SyRemaining">
+	<select id="queryRemainingByFabric2" resultType="org.jeecg.modules.cost.entity.SyRemaining">
 		select oti.cInvName as goodsName,ot.cFree1 as color,max(om.ccode) as planCode,sum(ot.iQuantity) as number
 	from UFDATA_101_2021.dbo.om_momain om
 	join UFDATA_101_2021.dbo.OM_MODetails od on om.moid=od.moid
@@ -317,6 +317,42 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%'
 	GROUP BY oti.cInvName,ot.cFree1
 	</select>
 
+	<!--	面料余下数量链接方法-->
+	<select id="queryRemainingByFabric" resultType="org.jeecg.modules.cost.entity.SyRemaining">
+		select a.cfree1 color,a.cInvName goodsName,a.comcode planCode,purchaseQuantity2-purchaseQuantity1 as number
+		from (select i.cInvCode,rs.cBatch,sum(rs.iQuantity) purchaseQuantity1 ,cfree1,cInvName,comcode
+			from UFDATA_101_2021.dbo.rdrecords11 rs
+			join UFDATA_101_2021.dbo.Inventory i on rs.cInvCode=i.cInvCode
+			where comcode in (
+			select distinct om.ccode
+			from UFDATA_101_2021.dbo.om_momain om
+			join UFDATA_101_2021.dbo.OM_MODetails od on om.moid=od.moid
+			join UFDATA_101_2021.dbo.Inventory omi on omi.cInvCode=od.cInvCode
+			WHERE om.iVerifyStateNew = 2
+			and omi.cInvCcode like '19%'
+			and om.cCode like CONCAT(#{code},'%')
+			)
+			and cInvName=#{goodName}
+			GROUP BY i.cInvCode,rs.cBatch,cfree1,cInvName ,comcode) a
+		left join (select i.cInvCode,sum(rs.iQuantity) as purchaseQuantity2,rs.cBatch as cBatch,cfree1,cInvName,comcode
+			from UFDATA_101_2021.dbo.rdrecords01 rs
+			join UFDATA_101_2021.dbo.Inventory i on rs.cInvCode=i.cInvCode
+			join UFDATA_101_2021.dbo.rdrecord01 r on rs.ID = r.ID
+			where cPOID in (
+			select distinct om.cPOID
+			from UFDATA_101_2021.dbo.PO_POmain om
+			join UFDATA_101_2021.dbo.PO_PODetails od on om.poid=od.poid
+			join UFDATA_101_2021.dbo.Inventory omi on omi.cInvCode=od.cInvCode
+			WHERE om.cVerifier is not null
+			and om.cPOID like CONCAT(#{code},'%')
+			) and r.cBusType = '普通采购'
+			and cInvName=#{goodName}
+			GROUP BY i.cInvCode,rs.cBatch,cfree1,cInvName,comcode ) b
+		on a.cInvCode=b.cInvCode and a.cBatch=b.cBatch and a.cfree1=b.cfree1
+		where purchaseQuantity2>purchaseQuantity1
+		ORDER BY number desc;
+	</select>
+
 
 <!--	多发少发链接-->
 	<select id="querypilosityFewer" parameterType="java.lang.String" resultType="org.jeecg.modules.cost.entity.SyCostAllocationFabric">

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/mapper/xml/SyCostAllocationMapper.xml

@@ -388,7 +388,7 @@ select omi.cInvName as cInvName,sum(pbs.iOriSum) as iOriSum,sum(round(pbs.iOriSu
 
     <select id="querySalerIauantity" resultType="org.jeecg.modules.cost.entity.SyCostAllocation">
 
-select t.salerIquantity from (
+select sum(t.salerIquantity) salerIquantity from (
 select sum(iquantity) as salerIquantity from UFDATA_101_2021.dbo.SO_SODetails where csocode in
 <foreach collection="csocode" item="value" index="index" open="(" separator="," close=")">
 #{value}

+ 10 - 5
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/mapper/xml/SyCostAllocationShipdetailMapper.xml

@@ -17,6 +17,11 @@
 	</select>
 
 	<select id="queryByCostShipdetail" resultType="org.jeecg.modules.cost.entity.SyCostAllocationShipdetail">
+
+		select* from VIEW_fenpei_chuyunmingxi where ccode like  CONCAT(#{code},'%') order by outdata;
+	</select>
+
+	<!--<select id="queryByCostShipdetail" resultType="org.jeecg.modules.cost.entity.SyCostAllocationShipdetail">
 select t.* from (
 					select sbv.cDefine10 AS invoiceNum,CONVERT(varchar(50), min(sbv.dDate), 23) as outdata,sum(pbv.iQuantity) as shipQuantity,sbv.iExchRate AS exchangeRate,sbv.cSOCode AS orderNum,max(pbv.cdefine22) AS poStyleNum,max(pbv.cDefine28) AS smallPo,max(sbv.exportUnitPrice) AS exportUnitPrice,sum(sbv.exportPrice) as exportPrice,sum(sbv.rmbAmount) as rmbAmount,
 case when max(sbv.cexch_name)='人民币' then max(pbv.iOriTaxCost) else round(max(pbv.iOriTaxCost)*max(pbv.cExchRate),4) end as procesUnitPricermb,
@@ -36,11 +41,11 @@ left join UFDATA_101_2021.dbo.SO_SODetails sd on sd.iSOsID = ommos.isosid
 group by pbv.cDefine10,pbvs.cInvCode,pbvs.cFree1,pbvs.cFree2,pbv.cBusType,inv.cInvCCode,ommo.ccode,ommo.cVenCode,pbvs.cDefine28
 having ommo.ccode like CONCAT(#{code},'%') AND pbv.cBusType='委外加工' and inv.cInvCCode like '19%') as pbv
 left join
--- 根据外销发票号 加物料编码以及自由项组合计算 销售发票合计数量
-(select sbv.cDefine10,sum(sbvs.iQuantity) as iQuantity,sbvs.cInvCode,sbvs.cFree1,sbvs.cFree2,min(sbv.dDate) as dDate,max(sbv.iExchRate) as iExchRate,sbv.cSOCode as cSOCode,max(sbvs.iTaxUnitPrice) AS exportUnitPrice,sum(sbvs.iSum) as exportPrice,sum(sbvs.iNatSum) as rmbAmount,max(sbv.cexch_name) as cexch_name,sbvs.cDefine28 as cDefine28 
+&#45;&#45; 根据外销发票号 加物料编码以及自由项组合计算 销售发票合计数量
+(select sbv.cDefine10,sum(sbvs.iQuantity) as iQuantity,sbvs.cInvCode,sbvs.cFree1,sbvs.cFree2,min(sbv.dDate) as dDate,max(sbv.iExchRate) as iExchRate,sbvs.cSOCode as cSOCode,max(sbvs.iTaxUnitPrice) AS exportUnitPrice,sum(sbvs.iSum) as exportPrice,sum(sbvs.iNatSum) as rmbAmount,max(sbv.cexch_name) as cexch_name,sbvs.cDefine28 as cDefine28
 from UFDATA_101_2021.dbo.SaleBillVouchs sbvs  left join UFDATA_101_2021.dbo.SaleBillVouch sbv on   sbv.SBVID=sbvs.SBVID
-group by  sbv.cDefine10,sbvs.cInvCode,sbvs.cFree1,sbvs.cFree2,sbv.cSOCode,sbvs.cDefine28
-) as sbv on sbv.cInvCode=pbv.cInvCode and sbv.cFree1=pbv.cFree1 and sbv.cFree2=pbv.cFree2 and pbv.iQuantity=sbv.iQuantity and pbv.cDefine10 = sbv.cDefine10 -- 自由项+合计数量做匹配
+group by  sbv.cDefine10,sbvs.cInvCode,sbvs.cFree1,sbvs.cFree2,sbvs.cSOCode,sbvs.cDefine28
+) as sbv on sbv.cInvCode=pbv.cInvCode and sbv.cFree1=pbv.cFree1 and sbv.cFree2=pbv.cFree2 and pbv.iQuantity=sbv.iQuantity and pbv.cDefine10 = sbv.cDefine10 and pbv. cdefine28 = sbv.cDefine28 &#45;&#45; 自由项+合计数量做匹配
 LEFT JOIN UFDATA_101_2021.dbo.Vendor v ON pbv.cVenCode= v.cVenCode
 GROUP BY sbv.cDefine10,sbv.iExchRate,sbv.cSOCode
 
@@ -228,5 +233,5 @@ UNION ALL
 
 
 		 ) t order by t.outdata
-	</select>
+	</select>-->
 </mapper>

+ 4 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/service/impl/SyCostAllocationServiceImpl.java

@@ -195,9 +195,6 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
         List<String> strs=Arrays.asList(syCostAllocation.getGarmentContractno().split(",")).stream().distinct().collect(Collectors.toList());
         List<String> strs3= syCostAllocationMapper.queryByCostHead2(plannum);
 //        System.out.println("获取成衣strs.size\t"+strs.size());
-        System.out.println("获取成衣strs1\t"+strs);
-        System.out.println("获取成衣strs2\t"+strs3);
-        System.out.println("获取成衣strs.toString().substring(1,strs.toString().length()-2)\t"+strs3.toString().substring(1,strs3.toString().length()-1));
         syCostAllocation.setGarmentContractno(strs.toString().substring(1,strs.toString().length()-1));
         // 销售订单附件
         List<AccessorItem> accessorItemList = new ArrayList<>();
@@ -275,6 +272,10 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
                 List<SyRemaining> syRemaining  = syCostAllocationFabricMapper.queryRemainingByFabric(plannum,Fabric.getGoodsName());
                 BigDecimal cost = new BigDecimal(BigInteger.ZERO);
                 for (SyRemaining syRemain:syRemaining) {
+                    System.out.println("Fabric.fabricremainingQuantity\t"+Fabric.getFabricremainingQuantity());
+                    System.out.println("syRemain.number\t"+syRemain.getNumber());
+                    System.out.println("syRemainList\n"+syRemain);
+//                    syRemain.setNumber(Fabric.getFabricremainingQuantity().toString());
                     //查询单证面损数据
                     SyFabricLossReport syFabricLossReport = null;
                     QueryWrapper<SyFabricLossReport> queryWrapper = new QueryWrapper<>();

+ 7 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/orderData/service/impl/SyOrderDataServiceImpl.java

@@ -60,6 +60,7 @@ public class SyOrderDataServiceImpl extends ServiceImpl<SyOrderDataMapper, SyOrd
         Result<T> result =new Result<>();
         //得到系统时间
         Date day=new Date();
+        int count=0;
         //定义集合
         List<Map<String, Object>> sumlist = new ArrayList<>();
         try {
@@ -420,7 +421,7 @@ public class SyOrderDataServiceImpl extends ServiceImpl<SyOrderDataMapper, SyOrd
                     updateById(sy);
                     isNewOrder=false;
                 }
-
+                count=syItemList.size();
                 if(syItemList.size() !=0){
                     save(sy);
                     //回写拉取的数据状态 1
@@ -453,7 +454,11 @@ public class SyOrderDataServiceImpl extends ServiceImpl<SyOrderDataMapper, SyOrd
             result.setMessage("同步失败!请联系管理员!!!");
             return result;
         }
-        result.setMessage("同步成功!!!");
+        if (count>0){
+            result.setMessage("同步成功!!!");
+        }else{
+            result.setMessage("暂无需要同步数据!!!");
+        }
         return result;
     }
 

+ 0 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/syShippingOrder/controller/SyShippingOrderController.java

@@ -249,7 +249,6 @@ public class SyShippingOrderController extends JeecgController<SyShippingOrder,
 		 queryWrapper.eq("del_flag",0);
 		 List<SyShippingOrderItem> list = syShippingOrderItemService.list(queryWrapper);
 		 entity.setSyShippingOrderItemList(list);
-
 		syShippingOrderService.syShippingOrderEdit(entity,syShippingOrder);
 
 		return Result.OK("编辑成功!");

+ 7 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/entity/SyPreAssembledPackingListItem.java

@@ -388,8 +388,8 @@ public class SyPreAssembledPackingListItem implements Serializable {
 				SizeTable sizeTable=new SizeTable();
 				sizeTable.setSize(parsms3[i]);//尺码
 				int box=0;
-				if(isNumeric(parsms2[i])){
-					box=Integer.parseInt(parsms2[i]);
+				if(isNumeric(parsms2[i])){//
+					box=((Double)Double.parseDouble(parsms2[i])).intValue();
 				}
 				piecesBox+=box;
 				sizeTable.setProportion(box);//比例
@@ -404,6 +404,10 @@ public class SyPreAssembledPackingListItem implements Serializable {
 			this.total=this.boxNumber.multiply(this.piecesBox);//数量
 			if(isNumeric(parsms[8])){
 				totalPack=new BigDecimal(parsms[8]);//件数包
+			}
+			if (totalPack==null||totalPack.intValue()==0){
+				totalPack=this.piecesBox;//件数包
+			}
 				//总件数 total
 //				if(isNumeric(parsms[18])){
 					System.out.println("this.piecesBox\t"+this.piecesBox+"\ttotalPack\t"+totalPack);
@@ -413,7 +417,6 @@ public class SyPreAssembledPackingListItem implements Serializable {
 //					packs=new BigDecimal(parsms[20]);//包数
 					packs=boxNumber.multiply(packBox);//包数
 //				}
-			}
 			System.out.println("\t包数/箱\t"+packBox+"\t件数/包\t"+totalPack+"\t包数\t"+packs);
 			this.totalNetWeight=this.boxNumber.multiply(this.netWeight);
 			this.totalGrossWeight=this.boxNumber.multiply(this.grossWeight);
@@ -473,6 +476,7 @@ public class SyPreAssembledPackingListItem implements Serializable {
 
 	}
 
+
 	public String toString3() {
 		String sizes="";
 		id="";

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

@@ -1480,7 +1480,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 
 							Map<String,Object> orderData2=syPackingListTailoringMapper.getOmOrPo("PO_POMAIN","cPOID='"+mapItem1.getOrderNumber()+"'","POID");//委外订单号判断 第一次
 
-							orderDataItem=syPackingListTailoringMapper.getOmOrPoItem2("PO_PoDetails", "poid='"+orderData2.get("id")+"' and ivouchrowno='"+
+							orderDataItem=syPackingListTailoringMapper.getOmOrPoItem2("PO_PoDetails", "poid='"+orderData2.get("id")+"' and id='"+
 									mapItem1.getIrowno()+"'","ID");//根据行号获取信息
 							if (orderDataItem==null){
 								throw new JeecgBootException(mapt.get("account")+"账套,单证委外订单子表id为"+orderData2.get("id")+",U8中无此ID 请联系管理员处理");
@@ -1615,6 +1615,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 				Order orderIrowno=new Order();
 				System.out.println("新的逻辑id\t"+orderDataItem.get("iSOsID"));
 				//if(item.getSyOrderDataItemId()!=null){//销售发货单 ---查询销售订单子表数据  顺序---5
+				String orderDataId="";
 				if(orderDataItem!=null&&orderDataItem.containsKey("iSOsID")&&orderDataItem.get("iSOsID")!=null){
 					//Map<String,Object> orderDataItem2=syPackingListTailoringMapper.getSoMainItem(orderDataItem.get("iSOsID").toString());
 					Map<String,Object> orderDataItem2=new HashMap<>();
@@ -1626,9 +1627,11 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 							id=id.substring(3);
 						}
 						orderDataItem2=syPackingListTailoringMapper.getSoMainItem2(id);
+						orderDataId=orderDataItem2.get("iSOsID").toString();
 						//mapItem3.put("AUTOID_SO",id);//来源单据明细ID
 					}else{
 						orderDataItem2=syPackingListTailoringMapper.getSoMainItem(orderDataItem.get("iSOsID").toString());
+						orderDataId=orderDataItem2.get("iSOsID").toString();
 					}
 					mapItem3.put("AUTOID_SO",orderDataItem2.get("iSOsID"));//来源单据明细ID
 					orderIrowno.setIrowno(orderDataItem2.get("irowno").toString());
@@ -1711,8 +1714,9 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 					}
 					//String params1="UFDATA_103_2021";//当前数据库
 					String params3=orderIrowno.getOrderNumber();//销售订单号
-					String params5=orderIrowno.getIrowno();//当前数据库行号
-					String ivouchrowno =syPackingListTailoringMapper.getIvouchrowno(params1,params2,params3,params4,params5);
+//					String params5=orderIrowno.getIrowno();//当前数据库行号
+					String params5=orderDataId;//当前数据库行号
+					String ivouchrowno =syPackingListTailoringMapper.getIvouchrowno2(params1,params2,params3,params4,params5);
 					orderIrowno.setIrowno(ivouchrowno);//获取行号
 					System.out.println("销售订单子表的行号\t"+ivouchrowno);
 					mapSort.put(item.getId(),orderIrowno);
@@ -2228,11 +2232,18 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 		DxpDataPlan dxpDataPlan=dxpDataPlanMapper.selectById("0012");
 		SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 		Date datetome = sf.parse(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS").format(System.currentTimeMillis()));
+		Date datetome2 = dxpDataPlan.getLastTime();
 		dxpDataPlan.setLastTime(datetome);
 		if(dxpDataPlan.getItemUrl().equals("f")){
 			dxpDataPlan.setItemUrl("t");
 			dxpDataPlanMapper.updateById(dxpDataPlan);
 		}else{
+			long time=(datetome.getTime()-datetome2.getTime())/1000;
+			System.out.println("time\t"+time);
+			if(time>1800){
+				dxpDataPlan.setItemUrl("f");
+				dxpDataPlanMapper.updateById(dxpDataPlan);
+			}
 			System.out.println("正在执行中");
 			return "正在执行中";
 		}

+ 4 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/mapper/SyPackingListTailoringMapper.java

@@ -83,6 +83,10 @@ public interface SyPackingListTailoringMapper extends BaseMapper<SyPackingListTa
     public String getIvouchrowno(@Param("params1") String params1,@Param("params2") String params2,@Param("params3") String params3
             ,@Param("params4") String params4,@Param("params5") String params5);
 
+    //获取目标行号   参数当前数据库,目标数据库,销售订单号,目标账套号,行号
+    public String getIvouchrowno2(@Param("params1") String params1,@Param("params2") String params2,@Param("params3") String params3
+            ,@Param("params4") String params4,@Param("params5") String params5);
+
     public List<SyPackingListTailoring> queryByList(String id);
 
     List<Map<String, Object>> getSuppliers(@Param("tableName")String tableName,@Param("codes")String[] toArray);

+ 14 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/mapper/xml/syPackingListTailoringMapper.xml

@@ -315,6 +315,20 @@
 
     </select>
 
+    <select id="getIvouchrowno2"   resultType="java.lang.String">
+        SELECT hy.predid FROM
+        so_sodetails soso
+        LEFT JOIN UFDATA_103_2021.dbo.HY_DZ_K7_SYNERGISMLOGDID hy
+        ON voucherno = soso.cSOCode
+        AND did = soso.isosid
+        LEFT JOIN ${params2}.dbo.po_podetails popos
+        ON popos.id = hy.predid
+        WHERE soso.cSOCode = #{params3}
+        AND hy.accid =  #{params4}
+        AND soso.iSOsID =  #{params5}
+
+    </select>
+
     <select id="getSyShippingOrder" resultType="java.util.HashMap"  parameterType="java.lang.String">
         select
             the_final_shipping_date as e1,