Browse Source

成本分配,订单数据调整

zengtx 1 year ago
parent
commit
6117d09cfe

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

@@ -79,10 +79,8 @@ public class SyCostAllocation implements Serializable {
     @ApiModelProperty(value = "加工单位")
     private String processUnit;
     /**出运日期*/
-    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
-    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
     @ApiModelProperty(value = "出运日期")
-    private Date outdata;
+    private String outdata;
     /**计划数量*/
     @ApiModelProperty(value = "计划数量")
     private java.math.BigDecimal planQuantity;
@@ -247,4 +245,9 @@ public class SyCostAllocation implements Serializable {
     // 销售订单附件
     List<AccessorItem> accessorItemList;
 
+    //公司承担金额美元
+    private java.math.BigDecimal pkorgAmount;
+    //公司承担金额人民币
+    private java.math.BigDecimal pkorgAmountrmb;
+
 }

+ 5 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/entity/SyCostAllocationAccident.java

@@ -105,4 +105,9 @@ public class SyCostAllocationAccident implements Serializable {
     @ApiModelProperty(value = "供应商事故单人民币金额")
     private java.math.BigDecimal supperAccidentcnyAmount;
 
+    //公司承担金额美元
+    private java.math.BigDecimal pkorgAmount;
+    //公司承担金额人民币
+    private java.math.BigDecimal pkorgAmountrmb;
+
 }

+ 4 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/mapper/xml/SyCostAllocationAccidentMapper.xml

@@ -19,8 +19,10 @@
 	<select id="queryByCostAccident" resultType="org.jeecg.modules.cost.entity.SyCostAllocationAccident">
 		select
 			it.id as id,its.u8_invoice as accidentNum,its.money_type,it.accident_number,its.accident_type,it.accident_theme,
-			case when its.money_type='美元' then ifnull(sum(its.accident_sum),0) end as amount,
-			case when its.money_type='人民币' then ifnull(sum(its.accident_sum),0) end as amountrmb,
+				case when its.money_type='美元' and its.accident_type != '公司承担' then ifnull(sum(its.practical_sum),0) end as amount,
+			case when its.money_type='人民币' and its.accident_type != '公司承担' then ifnull(sum(its.practical_sum),0) end as amountrmb,
+			case when its.money_type='美元' and its.accident_type = '公司承担' then ifnull(sum(its.practical_sum),0) end as pkorgAmount,
+			case when its.money_type='人民币' and its.accident_type = '公司承担' then ifnull(sum(its.practical_sum),0) end as pkorgAmountrmb,
 			CONCAT_WS(',',it.responsibility_person1,it.responsibility_person2,it.responsibility_person3,it.responsibility_person4) as responsibilityPerson1,
 			it.accident_data,it.responsibility_company as accidentUndertaker,it.customer,it.style_number,its.plan_number,it.plan_personnel,
 			it.business_people,it.garment_sales_order,material,it.quality_control,finance_remark

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

@@ -410,8 +410,14 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
                     Ingredient.setSyRemaining(remaininglist);
                 }
             }
-            //辅料成本 美元和人民币
+
+//            2023.08.30 改为美元金额 = 人民币金额除以销售订单汇率
+            if(oConvertUtils.isNotEmpty(Ingredient.getRmbAmount())){
+                Ingredient.setUsdAmount(Ingredient.getRmbAmount().divide(syCostAllocation.getExchangeRate(),2,BigDecimal.ROUND_HALF_UP));
+            }
+             //辅料成本 美元和人民币
             if(Ingredient.getUsdAmount()!=null){
+
                 if(syCostAllocation.getExcipiencostIncludestax()==null){
                     syCostAllocation.setExcipiencostIncludestax(BigDecimal.ZERO);
                     syCostAllocation.setExcipiencostIncludestaxUsd(BigDecimal.ZERO);

+ 1 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/vo/SyCostAllocationPage.java

@@ -72,9 +72,7 @@ public class SyCostAllocationPage {
   	@Excel(name = "加工单位", width = 15)
 	private String processUnit;
 	/**出运日期*/
-  	@Excel(name = "出运日期", width = 20, format = "yyyy-MM-dd HH:mm:ss")
-  	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
-    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+  	@Excel(name = "出运日期", width = 20)
 	private Date outdata;
 	/**计划数量*/
   	@Excel(name = "计划数量", width = 15)

+ 8 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/costLossReview/entity/CostAllocationReview.java

@@ -6,6 +6,8 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import org.jeecgframework.poi.excel.annotation.Excel;
 import org.springframework.format.annotation.DateTimeFormat;
+
+import java.math.BigDecimal;
 import java.util.Date;
 
 /**
@@ -122,4 +124,10 @@ public class CostAllocationReview {
 
     /*保存、提交、已指派、返单、完成*/
     private String status;
+
+    //公司承担金额美元
+    private java.math.BigDecimal pkorgAmount;
+    //公司承担金额人民币
+    private java.math.BigDecimal pkorgAmountrmb;
+
 }

+ 2 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/costLossReview/mapper/xml/SyCostLossReviewMapper.xml

@@ -270,7 +270,8 @@
         cost_info ->> '$.fabricshortcost'  AS fabricshortcost,
         cost_info ->> '$.preparedBy'  AS preparedBy,
         status,
-
+        cost_info ->> '$.pkorgAmount'  AS pkorgAmount,
+        cost_info ->> '$.pkorgAmountrmb'  AS pkorgAmountrmb,
         cost_info ->> '$.rejectDate'  AS rejectDate,
         cost_info ->> '$.finalApproveDate'  AS finalApproveDate,
         cost_info ->> '$.usdTotalexportprice'  AS usdTotalexportprice,

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

@@ -410,28 +410,40 @@ public class SyOrderDataServiceImpl extends ServiceImpl<SyOrderDataMapper, SyOrd
                            // continue;
                        // }
                     }
+                    //添加主表数据进入数据库
+                    for (SyOrderDataItem sy2:syItemList) {
+                        syOrderDataItemService.save(sy2);
+                    }
                 }
-                //添加主表数据进入数据库
-                for (SyOrderDataItem sy2:syItemList) {
-                    syOrderDataItemService.save(sy2);
-                }
+
                 if(isNewOrder){
                     updateById(sy);
                     isNewOrder=false;
-                }else{
-                    save(sy);
                 }
 
-
-                //回写拉取的数据状态 1
-                String blackWrite = "UPDATE SO_SOMain SET cdefine15 = '1' WHERE id='"+syId+"'";
-                if(sy.getAccount().equals("101")){
-                    senYuDataSourceOne.update(blackWrite);
-                }else if(sy.getAccount().equals("102")){
-                    senYuDataSourceTwo.update(blackWrite);
-                }else if(sy.getAccount().equals("103")){
-                    senYuDataSourceThree.update(blackWrite);
+                if(syItemList.size() !=0){
+                    save(sy);
+                    //回写拉取的数据状态 1
+                    String blackWrite = "UPDATE SO_SOMain SET cdefine15 = '1' WHERE id='"+syId+"'";
+                    if(sy.getAccount().equals("101")){
+                        senYuDataSourceOne.update(blackWrite);
+                    }else if(sy.getAccount().equals("102")){
+                        senYuDataSourceTwo.update(blackWrite);
+                    }else if(sy.getAccount().equals("103")){
+                        senYuDataSourceThree.update(blackWrite);
+                    }
+                }else{
+                    //回写拉取的数据状态 1
+                    String blackWrite = "UPDATE SO_SOMain SET cdefine15 = '0' WHERE id='"+syId+"'";
+                    if(sy.getAccount().equals("101")){
+                        senYuDataSourceOne.update(blackWrite);
+                    }else if(sy.getAccount().equals("102")){
+                        senYuDataSourceTwo.update(blackWrite);
+                    }else if(sy.getAccount().equals("103")){
+                        senYuDataSourceThree.update(blackWrite);
+                    }
                 }
+
             }
             dxpDataPlanService.updateLastTime(day,"senYu_syOrder");
         } catch (Exception e) {

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

@@ -226,13 +226,13 @@ public class AddOrderJob implements Job,ApplicationContextAware {
                     //如果902销售订单客户 做判断 如果是香港森语 就需要向上追溯(取佣金)
                     if(sy.getAccount().equals("102") && sy.getCustomerAbbreviation().equals("International Apparel Group")) {
                         String ymoneySql = "select  sosose901.cbdefine2 as ymoney " +
-                                "from UFDATA_902_2021.dbo.SO_SODetails sosos902 " +
-                                "left join UFDATA_902_2021.dbo.SO_SOmain soso902 on soso902.id=sosos902.id " +
+                                "from UFDATA_102_2021.dbo.SO_SODetails sosos902 " +
+                                "left join UFDATA_102_2021.dbo.SO_SOmain soso902 on soso902.id=sosos902.id " +
                                 "left join UFDATA_103_2021.dbo.HY_DZ_K7_SYNERGISMLOGDID HDK on  " +
                                 "(HDK.accid='1000000002'and soso902.cCusCode='T020001' ) and hdk.did=sosos902.iSOsID and hdk.cvouchertype='17' " +
-                                "left join UFDATA_901_2021.dbo.PO_Podetails popos901 on popos901.id=hdk.PreDid  " +
-                                "left join UFDATA_901_2021.dbo.SO_SODetails_extradefine sosose901 on sosose901.iSOsID=popos901.iorderdid " +
-                                "left join UFDATA_902_2021.dbo.Inventory inv902 on inv902.cInvCode=sosos902.cInvCode  " +
+                                "left join UFDATA_101_2021.dbo.PO_Podetails popos901 on popos901.id=hdk.PreDid  " +
+                                "left join UFDATA_101_2021.dbo.SO_SODetails_extradefine sosose901 on sosose901.iSOsID=popos901.iorderdid " +
+                                "left join UFDATA_102_2021.dbo.Inventory inv902 on inv902.cInvCode=sosos902.cInvCode  " +
                                 "where soso902.cCusCode='T020001' and left(inv902.cInvCCode,2)='19'  " +
                                 "and soso902.cSOCode='"+sy.getOrderNumber()+"' and sosos902.AutoID =" + sy2.getId();
                         List<Map<String, Object>> ymoneyList = new ArrayList<>();
@@ -250,6 +250,8 @@ public class AddOrderJob implements Job,ApplicationContextAware {
                     }
 
                     sy2.setId(sy.getAccount()+sy2.getId());
+
+                    //查询订单子表数据,这里存在主表数据为true
                     if(isNewOrder){
                         String item = syOrderDataItemService.queryItemMub(sy2.getId());
                         if(item!=null && item.equals("已被参照")){
@@ -311,7 +313,7 @@ public class AddOrderJob implements Job,ApplicationContextAware {
                     for (SyOrderDataItem str : entityList) {
                         deleteId.add(str.getId());
                     }
-                    //比对两个几个的差集,删除deleteId集合不存的ID
+                    //比对两个几个的差集,删除deleteId集合不存的ID(这里是U8删除了,单证有多余的数据)
                     Collection subtract = CollectionUtils.subtract(deleteId, idsID);
                     for (Object s : subtract) {
                         //删除没用的数据
@@ -336,25 +338,37 @@ public class AddOrderJob implements Job,ApplicationContextAware {
                         }
                         continue;
                     }
-                }
-                //添加主子表数据进入数据库
-                for (SyOrderDataItem sy2:syItemList) {
-                    syOrderDataItemService.save(sy2);
+
+                    //添加主子表数据进入数据库
+                    for (SyOrderDataItem sy2:syItemList) {
+                        syOrderDataItemService.save(sy2);
+                    }
                 }
                 if(isNewOrder){
                     syOrderDataService.updateById(sy);
                     isNewOrder=false;
-                }else {
-                    syOrderDataService.save(sy);
                 }
-                //回写拉取的数据状态 1
-                String blackWrite = "UPDATE SO_SOMain SET cdefine15 = '1' WHERE id='"+syId+"'";
-                if(sy.getAccount().equals("101")){
-                    senYuDataSourceOne.update(blackWrite);
-                }else if(sy.getAccount().equals("102")){
-                    senYuDataSourceTwo.update(blackWrite);
-                }else if(sy.getAccount().equals("103")){
-                    senYuDataSourceThree.update(blackWrite);
+                if(syItemList.size() !=0){
+                    syOrderDataService.save(sy);
+                    //回写拉取的数据状态 1
+                    String blackWrite = "UPDATE SO_SOMain SET cdefine15 = '1' WHERE id='"+syId+"'";
+                    if(sy.getAccount().equals("101")){
+                        senYuDataSourceOne.update(blackWrite);
+                    }else if(sy.getAccount().equals("102")){
+                        senYuDataSourceTwo.update(blackWrite);
+                    }else if(sy.getAccount().equals("103")){
+                        senYuDataSourceThree.update(blackWrite);
+                    }
+                }else{
+                    //回写拉取的数据状态 1
+                    String blackWrite = "UPDATE SO_SOMain SET cdefine15 = '0' WHERE id='"+syId+"'";
+                    if(sy.getAccount().equals("101")){
+                        senYuDataSourceOne.update(blackWrite);
+                    }else if(sy.getAccount().equals("102")){
+                        senYuDataSourceTwo.update(blackWrite);
+                    }else if(sy.getAccount().equals("103")){
+                        senYuDataSourceThree.update(blackWrite);
+                    }
                 }
             }
             dxpDataPlanService.updateLastTime(day,"senYu_syOrder");