ソースを参照

成本分配,订单拉取

zengtx 1 年間 前
コミット
db1dbb5a9a

+ 8 - 7
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/mapper/SyCostAllocationIngredientMapper.java

@@ -24,22 +24,23 @@ public interface SyCostAllocationIngredientMapper extends BaseMapper<SyCostAlloc
 	@DS("multi-three")
 	List<SyCostAllocationIngredient> queryByCostIngredient(String code);
 	@DS("multi-three")
-	List<SyCostAllocationIngredient> queryByCostIngredient1(String code);
+	List<SyCostAllocationIngredient> queryByCostIngredient1(@Param("table") String table,@Param("code") String code);
 	@DS("multi-three")
 	List<SyTransfer> queryTransferByIngredient(@Param("code") String code, @Param("goodName") String goodName);
 	@DS("multi-three")
 	List<SyRemaining> queryRemainingByIngredient(@Param("code") String code, @Param("goodName") String goodName);
 
-	//查询新增分配表辅料数据
+	//删除临时表
 	@DS("multi-one")
-	void deleteTempTable101();
+	void deleteTempTable101(@Param("table") String table);
+	//创建临时表
 	@DS("multi-one")
-	void createTempTable101();
+	void createTempTable101(@Param("table") String table);
 	@DS("multi-one")
-	void insertDataIntoTempTable101_101(@Param("code") String code);
+	void insertDataIntoTempTable101_101(@Param("table") String table,@Param("code") String code);
 	@DS("multi-one")
-	void insertDataIntoTempTable101_102(@Param("code") String code);
+	void insertDataIntoTempTable101_102(@Param("table") String table,@Param("code") String code);
 	@DS("multi-one")
-	void insertDataIntoTempTable101_103(@Param("code") String code);
+	void insertDataIntoTempTable101_103(@Param("table") String table,@Param("code") String code);
 
 }

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

@@ -17,12 +17,12 @@
 	</select>
 
 	<update id="deleteTempTable101">
-        DROP TABLE ##fenpeiTable;
+        DROP TABLE ${table};
 	</update>
 
 	<insert id="createTempTable101">
 
-		 CREATE TABLE ##fenpeiTable (
+		 CREATE TABLE ${table}(
             ccode varchar(50),
             cInvCode varchar(50),
             goodsName varchar(200),
@@ -38,7 +38,7 @@
 
 	<insert id="insertDataIntoTempTable101_101">
 
-		insert into ##fenpeiTable select t3.ccode as ccode,t3.cInvCode,t3.goodsName,max(t3.dosage) as dosage,sum(t3.usageQuantity) as usageQuantity,max(t3.cVenAbbName) as supper,sum(t3.rmbAmount) as rmbAmount,sum(t3.usdAmount) as usdAmount,sum(t3.priceExcludingtax) as priceExcludingtax,sum(t3.iCost) as cost from (
+		insert into ${table} select t3.ccode as ccode,t3.cInvCode,t3.goodsName,max(t3.dosage) as dosage,sum(t3.usageQuantity) as usageQuantity,max(t3.cVenAbbName) as supper,sum(t3.rmbAmount) as rmbAmount,sum(t3.usdAmount) as usdAmount,sum(t3.priceExcludingtax) as priceExcludingtax,sum(t3.iCost) as cost from (
 
 		select t1.ccode as ccode,t1.cInvCode,t1.goodsName,t1.dosage,t1.usageQuantity,t2.cVenAbbName,t2.rmbAmount,t2.usdAmount,t2.priceExcludingtax,t2.iCost from (select ot.cInvCode,od.isosid,om.ccode,oti.cInvName as goodsName,sum(ot.iUnitQuantity) as dosage,sum(ot.iSendQTY) as usageQuantity
 
@@ -71,7 +71,7 @@ join UFDATA_103_2021.dbo.cost_allocation_accessories_view vif on om.ccode = vif.
 	</insert>
 
 	<insert id="insertDataIntoTempTable101_102">
-insert into ##fenpeiTable select t3.ccode,t3.cInvCode,t3.goodsName,max(t3.dosage) as dosage,sum(t3.usageQuantity) as usageQuantity,max(t3.cVenAbbName) as supper,sum(t3.rmbAmount) as rmbAmount,sum(t3.usdAmount) as usdAmount,sum(t3.priceExcludingtax) as priceExcludingtax,sum(t3.iCost) as cost from (
+insert into ${table} select t3.ccode,t3.cInvCode,t3.goodsName,max(t3.dosage) as dosage,sum(t3.usageQuantity) as usageQuantity,max(t3.cVenAbbName) as supper,sum(t3.rmbAmount) as rmbAmount,sum(t3.usdAmount) as usdAmount,sum(t3.priceExcludingtax) as priceExcludingtax,sum(t3.iCost) as cost from (
 
 		select t1.ccode,t1.cInvCode,t1.goodsName,t1.dosage,t1.usageQuantity,t2.cVenAbbName,t2.rmbAmount,t2.usdAmount,t2.priceExcludingtax,t2.iCost from (select ot.cInvCode,od.isosid,om.ccode,oti.cInvName as goodsName,sum(ot.iUnitQuantity) as dosage,sum(ot.iSendQTY) as usageQuantity
 
@@ -107,7 +107,7 @@ join UFDATA_103_2021.dbo.cost_allocation_accessories_view vif on om.ccode = vif.
 	</insert>
 
 	<insert id="insertDataIntoTempTable101_103">
-insert into ##fenpeiTable select t3.ccode,t3.cInvCode,t3.goodsName,max(t3.dosage) as dosage,sum(t3.usageQuantity) as usageQuantity,max(t3.cVenAbbName) as supper,sum(t3.rmbAmount) as rmbAmount,sum(t3.usdAmount) as usdAmount,sum(t3.priceExcludingtax) as priceExcludingtax,sum(t3.iCost) as cost from (
+insert into ${table} select t3.ccode,t3.cInvCode,t3.goodsName,max(t3.dosage) as dosage,sum(t3.usageQuantity) as usageQuantity,max(t3.cVenAbbName) as supper,sum(t3.rmbAmount) as rmbAmount,sum(t3.usdAmount) as usdAmount,sum(t3.priceExcludingtax) as priceExcludingtax,sum(t3.iCost) as cost from (
 
 		select t1.ccode,t1.cInvCode,t1.goodsName,t1.dosage,t1.usageQuantity,t2.cVenAbbName,t2.rmbAmount,t2.usdAmount,t2.priceExcludingtax,t2.iCost from (select  ot.cInvCode,od.isosid,om.ccode,oti.cInvName as goodsName,sum(ot.iUnitQuantity) as dosage,sum(ot.iSendQTY) as usageQuantity
 
@@ -314,7 +314,7 @@ and (om.cCloser is null or ( (od.iReceivedQTY is not null or od.iReceivedQTY !=
 		(
 
 		select t4.cInvCode,max(t4.goodsName) as goodsName,max(t4.dosage) as dosage,max(t4.usageQuantity) as usageQuantity,STRING_AGG(t4.supper,',') as supper,sum(t4.rmbAmount) as rmbAmount,sum(t4.usdAmount) as usdAmount,sum(t4.priceExcludingtax) as priceExcludingtax,sum(t4.cost) as cost from
-	    ##fenpeiTable t4
+	    ${table} t4
 
 		where t4.cInvCode not in(
 		select cInvCode from UFDATA_103_2021.dbo.cost_allocation_fabric_view vif

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

@@ -385,16 +385,16 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
 
 
         //创建临时表
-        syCostAllocationIngredientMapper.createTempTable101();
+        syCostAllocationIngredientMapper.createTempTable101("##"+plannum);
         //插入临时表
-        syCostAllocationIngredientMapper.insertDataIntoTempTable101_101(plannum);
-        syCostAllocationIngredientMapper.insertDataIntoTempTable101_102(plannum);
-        syCostAllocationIngredientMapper.insertDataIntoTempTable101_103(plannum);
+        syCostAllocationIngredientMapper.insertDataIntoTempTable101_101("##"+plannum,plannum);
+        syCostAllocationIngredientMapper.insertDataIntoTempTable101_102("##"+plannum,plannum);
+        syCostAllocationIngredientMapper.insertDataIntoTempTable101_103("##"+plannum,plannum);
         //查询U8数据 辅料数据关联临时表
-        List<SyCostAllocationIngredient> list4 = syCostAllocationIngredientMapper.queryByCostIngredient1(plannum);
+        List<SyCostAllocationIngredient> list4 = syCostAllocationIngredientMapper.queryByCostIngredient1("##"+plannum,plannum);
 
         //删除临时表
-        syCostAllocationIngredientMapper.deleteTempTable101();
+        syCostAllocationIngredientMapper.deleteTempTable101("##"+plannum);
         for (int i=0;i<list4.size();i++) {
             SyCostAllocationIngredient Ingredient = list4.get(i);
             //若转入数量不为0则给转入数据对象赋值

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

@@ -673,10 +673,8 @@ public class SyShippingOrderController extends JeecgController<SyShippingOrder,
 					 tatolMoney = tatolMoney.add(li.getTotalPrice());
 					 tatolVolume = tatolVolume.add(li.getVolume());
 					 tatolBoxnumber = tatolBoxnumber.add(li.getBoxNumber());
-					 if(oConvertUtils.isEmpty(li.getTotalDeclarationTotalPrice())){
-						 li.setTotalDeclarationTotalPrice(li.getTotalPrice());
-					 }
-					 totalDeclarationTotalPrice = totalDeclarationTotalPrice.add(li.getTotalDeclarationTotalPrice());
+
+					 totalDeclarationTotalPrice = totalDeclarationTotalPrice.add(li.getDeclarationTotalPrice());
 					 li.setDestination(entity.getArriveInCountry());
 					 if(oConvertUtils.isEmpty(li.getDeclarationUnitPrice())){
 						 li.setDeclarationUnitPrice(li.getUnitPrice());
@@ -697,10 +695,7 @@ public class SyShippingOrderController extends JeecgController<SyShippingOrder,
 					 tatolMoney = tatolMoney.add(li.getTotalPrice());
 					 tatolVolume = tatolVolume.add(li.getVolume());
 					 tatolBoxnumber = tatolBoxnumber.add(li.getBoxNumber());
-					 if(oConvertUtils.isEmpty(li.getTotalDeclarationTotalPrice())){
-						 li.setTotalDeclarationTotalPrice(li.getTotalPrice());
-					 }
-					 totalDeclarationTotalPrice = totalDeclarationTotalPrice.add(li.getTotalDeclarationTotalPrice());
+					 totalDeclarationTotalPrice = totalDeclarationTotalPrice.add(li.getDeclarationTotalPrice());
 					 li.setDestination(entity.getArriveInCountry());
 					 if(oConvertUtils.isEmpty(li.getDeclarationUnitPrice())){
 						 li.setDeclarationUnitPrice(li.getUnitPrice());
@@ -723,6 +718,9 @@ public class SyShippingOrderController extends JeecgController<SyShippingOrder,
 			 entity.setTotalVolume(tatolVolume);
 			 //总箱数
 			 entity.setBoxNumber(tatolBoxnumber);
+			 //报关总金额
+			 entity.setTotalDeclarationTotalPrice(totalDeclarationTotalPrice);
+
 			 //判空
 			 if (oConvertUtils.isEmpty(entity.getUnitInOperation())) { entity.setUnitInOperation(" "); }
 			 if (oConvertUtils.isEmpty(entity.getCustomsCode())) {entity.setCustomsCode(" ");}

+ 4 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/syShippingOrder/entity/SyShippingOrder.java

@@ -351,4 +351,8 @@ public class SyShippingOrder {
 	//经营单位FAX
 	@TableField(exist = false)
 	private String fax;
+
+	//报关总金额(结汇发票使用)
+	@TableField(exist = false)
+	private BigDecimal totalDeclarationTotalPrice;
 }

+ 1 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/syShippingOrder/entity/SyShippingOrderItem.java

@@ -346,7 +346,5 @@ public class SyShippingOrderItem {
 	//报关金额(结汇发票使用)
 	@TableField(exist = false)
 	private BigDecimal declarationTotalPrice;
-	//报关总金额(结汇发票使用)
-	@TableField(exist = false)
-	private BigDecimal totalDeclarationTotalPrice;
+
 }

+ 11 - 6
jeecg-boot-module-system/src/main/java/org/jeecg/modules/quartz/job/AddOrderJob.java

@@ -27,6 +27,8 @@ import org.springframework.context.ApplicationContextAware;
 
 import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
+import java.time.LocalDate;
+import java.time.Period;
 import java.util.*;
 
 @PersistJobDataAfterExecution
@@ -50,7 +52,7 @@ public class AddOrderJob implements Job,ApplicationContextAware {
     }
 
     public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
-        System.out.println("销售订单拉取U8数据定时任务开始========================》");
+        log.info("销售订单拉取U8数据定时任务开始========================》");
         //得到系统时间
         Date day=new Date();
         //传出JSON
@@ -69,10 +71,13 @@ public class AddOrderJob implements Job,ApplicationContextAware {
             List<DxpDataPlan> resultList = pageList.getRecords();
             String pkorg = resultList.get(0).getPkOrg();
             String pkorgSplit[] = pkorg.split(",");
-            Date lastTiem = resultList.get(0).getLastTime();
-            SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
-            String lastTimeSf = sf.format(lastTiem);
-            String toDay = sf.format(day);//若客户单据日期没有具体时间 则要在同步数据前删除这次同步时间段的数据
+
+            // 获取当前日期
+            LocalDate currentDate = LocalDate.now();
+            // 计算半年前的日期
+            LocalDate halfYearAgo = currentDate.minus(Period.ofMonths(6));
+            // 格式化输出日期
+            String formattedDate = halfYearAgo.toString();
 
             for (String str : pkorgSplit) {
                 String pkorgStr = str;
@@ -128,7 +133,7 @@ public class AddOrderJob implements Job,ApplicationContextAware {
                         " LEFT JOIN Customer cc ON s.cCusCode = cc.cCusCode" +
                         " LEFT JOIN Person  pe ON s.cPersonCode = pe.cPersonCode" +
                         " left join Vendor v on s.cDefine12=v.cVenName" +
-                        " where s.iStatus = 1 and (s.cCloser is null or s.cCloser='asuser') AND (s.cdefine15 is null or  s.cdefine15 !='1' and s.cdefine15 !='2') ";
+                        " where s.iStatus = 1 and (s.cCloser is null or s.cCloser='asuser') AND (s.cdefine15 is null or  s.cdefine15 !='1' and s.cdefine15 !='2') and dverifydate > "+formattedDate;
 
                 if(this.parameter==null || this.parameter.equals("") || this.parameter.equals(" ")){
                     sql=sql+" order by s.dDate desc ";