Browse Source

单证问题调整

zengtx 1 year ago
parent
commit
19e8b95511

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

@@ -133,7 +133,7 @@
     <select id="queryPurBillVouchByFabric" resultType="org.jeecg.modules.cost.entity.SyCostAllocation">
 
 
-	select t.iOriSum as fabriccostIncludestax,t.iNotOriMoney as fabriccostNotincludestax, t.cExchRate as fabriccostIncludestaxUsd from (
+	select sum(t.iOriSum) as fabriccostIncludestax,sum(t.iNotOriMoney) as fabriccostNotincludestax, sum(t.cExchRate) as fabriccostIncludestaxUsd from (
 	select sum(pbs.iOriSum) as iOriSum,sum(round(pbs.iOriSum/1.13,4)) as iNotOriMoney,CONVERT(DECIMAL(38,2),sum(pbs.iOriSum)/max(so.iExchRate)) as cExchRate from UFDATA_101_2021.dbo.PO_Pomain pm
 	join UFDATA_101_2021.dbo.PO_Podetails pd on pm.POID = pd.POID
 	join UFDATA_101_2021.dbo.PurBillVouchs pbs on pd.ID = pbs.iPOsID

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

@@ -323,9 +323,10 @@
 
     <select id="querySyFabricLossByCode" resultType="org.jeecg.modules.documents.costLossReview.entity.SyCostLossReview">
         select
-        *
-        from loss_cost_paln_view
-        where planCode=#{planCode} group by planCode
+        submit_date as fsubmitDate,reject_date as frejectDate,first_approve_date as ffirstApproveDate,
+        final_approve_date as ffinalApproveDate,status as fstatus
+        from sy_fabric_loss_report
+        where plan_code=#{planCode}
     </select>
 
     <select id="queryCostAllocationByCode" resultType="org.jeecg.modules.documents.costLossReview.entity.SyCostLossReview">

+ 3 - 5
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/orderData/mapper/xml/SyOrderDataItemMapper.xml

@@ -4,28 +4,26 @@
     <select id="queryList" resultType="org.jeecg.modules.documents.orderData.entity.SyOrderDataItem" >
         SELECT
             sy_order_data_id,item_number,pre_delivery_date,pre_completion_date,pack_id,small_po,distribution_point,
-            inventory_code,inventory_name,specification_and_model,colour,coding_rules,guangpei_gate_width,box_number,
+            inventory_code,inventory_name,specification_and_model,colour,GROUP_CONCAT(DISTINCT coding_rules) as codingRules,guangpei_gate_width,box_number,
             sum(quantity) as quantity,master_metering,unit_price_including_tax,sum(total_price_and_tax) as total_price_and_tax,tax_rate,remarks,bank_closed_by
         FROM
             sy_order_data_item
         WHERE
             sy_order_data_id = #{syOrderDataId} and inventory_ccode like '19%'
         GROUP BY
-            pack_id,
             small_po,
             distribution_point,
             pre_delivery_date,
             pre_completion_date,
             item_number,
             inventory_code,
-            colour,
-            coding_rules
+            colour
 
         union all
 
         SELECT
             sy_order_data_id,item_number,pre_delivery_date,pre_completion_date,pack_id,small_po,distribution_point,
-            inventory_code,inventory_name,specification_and_model,colour,coding_rules,guangpei_gate_width,box_number,
+            inventory_code,inventory_name,specification_and_model,colour,GROUP_CONCAT(DISTINCT coding_rules) as codingRules,guangpei_gate_width,box_number,
             quantity as quantity,master_metering,unit_price_including_tax,total_price_and_tax as total_price_and_tax,tax_rate,remarks,bank_closed_by
         FROM
             sy_order_data_item

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/shippingDetails/mapper/xml/SyShippingDetailsMapper.xml

@@ -9,7 +9,7 @@
            a.sales_type_text as salesTypeText,a.customer_abbreviation as customerAbbreviation,a.customer_name as customerName,sum(b.surplus_num) as surplusNum,DATE_FORMAT(b.pre_completion_date,'%Y-%m-%d') as preCompletionDate,
            a.brand_side as brandSide,a.exchange_rate as exchangeRate,b.specification_and_model as specificationAndModel,a.account as account,b.inventory_code as inventoryCode,
            b.distribution_point as distributionPoint,b.pack_id as packId,b.unit_price_including_tax as unitPriceIncludingTax,guangpei_gate_width as guangpeiGateWidth,b.master_metering as masterMetering,
-           b.supplier_code as supplierCode,a.garment_nmb as garmentNmb,b.garment_factory as garmentFactory,DATE_FORMAT(b.pre_delivery_date,'%Y-%m-%d') as preDeliveryDate,b.box_number as boxNumber,
+           b.supplier_code as supplierCode,a.garment_nmb as garmentNmb,b.garment_factory as garmentFactory,DATE_FORMAT(b.pre_delivery_date,'%Y-%m-%d') as preDeliveryDate,sum(b.box_number) as boxNumber,
            a.whole_order_total as wholeOrderTotal,a.sales_department as salesDepartment,a.salesman as salesman,a.currency_text as currencyText,a.third_party as thirdParty,
             a.deposit_ratio as depositRatio,a.deposit as deposit,a.collaborative_route as collaborativeRoute,a.term_of_payment as termOfPayment,b.is_tc as isTc,
            if(left(b.inventory_ccode,2)='19',

+ 16 - 10
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/shippingDetails/service/impl/SyShippingDetailsServiceImpl.java

@@ -239,22 +239,28 @@ public class SyShippingDetailsServiceImpl extends ServiceImpl<SyShippingDetailsM
         List<SyShippingDetailsItem> list = entity.getSyShippingDetailsItemList();
 
         for(SyShippingDetailsItem li :list){
+            BigDecimal totalNum = BigDecimal.ZERO;
             //查询订单子表信息
             SyOrderDataItem orderDataItem = syOrderDataItemService.getById(li.getSyOrderDataItemId());
 
             if (oConvertUtils.isNotEmpty(orderDataItem)) {
+                //查询是否有已发货过的数据
+                QueryWrapper<SyShippingDetailsItem> queryWrapper = new QueryWrapper<>();
+                queryWrapper.eq("sy_order_data_item_id",orderDataItem.getId()).eq("del_flag","0")
+                        .ne("id",li.getId());
+                List<SyShippingDetailsItem> items = syShippingDetailsItemService.list(queryWrapper);
+                if(items.size()!=0){
+                    for(SyShippingDetailsItem it : items){
+                        totalNum = totalNum.add(it.getShipmentQuantity());
+                    }
+                }
+                    //之前数量加上本次发货数量
+                    totalNum = totalNum.add(li.getShipmentQuantity());
 
-                if(li.getShipmentQuantity().compareTo(orderDataItem.getQuantity()) == 1){
-                    BigDecimal suerBox = li.getShipmentQuantity().subtract(orderDataItem.getQuantity());
-                    BigDecimal suerBox2 = orderDataItem.getSurplusNum().subtract(suerBox);
-                    orderDataItem.setSurplusNum(suerBox2);
-                    syOrderDataItemService.updateById(orderDataItem);
-                }else if(li.getShipmentQuantity().compareTo(orderDataItem.getQuantity()) == -1){
-                    BigDecimal suerBox = orderDataItem.getQuantity().subtract(li.getShipmentQuantity());
-                    BigDecimal suerBox2 = orderDataItem.getSurplusNum().add(suerBox);
-                    orderDataItem.setSurplusNum(suerBox2);
+                    BigDecimal suerBox = orderDataItem.getQuantity().subtract(totalNum);
+                    orderDataItem.setSurplusNum(suerBox);
                     syOrderDataItemService.updateById(orderDataItem);
-                }
+
                 //设置发运明细子表剩余数量
                 li.setSurplusQuantity(li.getShipmentQuantity());
             }

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

@@ -339,4 +339,6 @@ public class SyShippingOrderItem {
 	//报关单序号
 	@TableField(exist = false)
 	private Integer size;
+
+	private String isTc;
 }

+ 4 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/syShippingOrder/mapper/xml/SyShippingOrderMapper.xml

@@ -149,12 +149,12 @@ where a.sy_shipping_order_item_id =#{id}
     <!--    成衣托书发票-->
     <select id="queryEelement" resultType="org.jeecg.modules.documents.syShippingOrder.entity.SyShippingOrderItem">
 
-select t.preDate,t.supplier,t.id, t.hsCode,sum(t.boxNumber) as boxNumber, t.declarationName,t.englishProductName,sum(t.number) as number,round(t.unitPrice,2) as unitPrice,
+select case when t.istc ='0' then '否' else '是' end as isTc,t.preDate,t.supplier,t.id, t.hsCode,sum(t.boxNumber) as boxNumber, t.declarationName,t.englishProductName,sum(t.number) as number,round(t.unitPrice,2) as unitPrice,
 round(sum(t.totalPrice),2) as totalPrice,round(sum(t.grossWeight),2) as grossWeight,round(sum(t.netWeight),2) as netWeight,t.pcs,t.pacs,
 round(sum(t.volume),3) as volume,t.curr,t.dree,t.place,t.certificate,t.styleNumber,t.smailPo,t.orderNumber,t.ctns,t.kgs,t.cbm,pkOrg,t.factoryUnitPrice,
 t.outerBoxLength,t.outerBoxWidth,t.outerBoxHeight,t.hod,t.unIt,t.emp,GROUP_CONCAT(DISTINCT t.purchaseOutsourcingOrderNo) as purchaseOutsourcingOrderNo,t.packId,t.salesman,t.earliestDeliveryDate,t.declarationUnit,
 t.clientAbbreviation,t.pcGw,t.priceGw from (
-select DATE_FORMAT(a.pre_shipment_date,'%y-%m-%d') as preDate,a.garment_factory as garmentFactory,a.supplier,GROUP_CONCAT(a.id) as id,b.hs_code as hsCode,b.declaration_name as declarationName,b.english_product_name as englishProductName,sum(a.number) as number,a.unit_price as unitPrice,
+select del.istc as isTc,DATE_FORMAT(a.pre_shipment_date,'%y-%m-%d') as preDate,a.garment_factory as garmentFactory,a.supplier,GROUP_CONCAT(a.id) as id,b.hs_code as hsCode,b.declaration_name as declarationName,b.english_product_name as englishProductName,sum(a.number) as number,a.unit_price as unitPrice,
 sum(a.number*a.unit_price) as totalPrice,a.gross_weight as grossWeight,a.net_weight as netWeight,a.master_metering as pcs,a.volume as volume,a.elements_Id as elementsId,
 'USD' as curr,'CHINA' as dree,'宁波其他/宁波象山县' as place,'照章征税' as certificate,a.style_number as styleNumber,a.smail_po as smailPo,a.box_number as boxNumber,
 a.order_number as orderNumber,a.client_abbreviation as clientAbbreviation,'PCS' as pacs,'CTNS' as ctns,'KGS' as kgs,'CBM' as cbm,c.salesman as salesman,'PC' as pcGw,'/PC' as priceGw,
@@ -165,6 +165,8 @@ left join sy_declaration_elements b
 on a.elements_Id = b.id
 left join sy_packing_list_tailoring_item c
 on a.tailoring_fabric_item_id = c.id
+left join (select is_tc as istc,item_number as itemNumber,inventory_code as inventoryCode,order_number as orderNumber from sy_shipping_details_item where del_flag = '0' group by item_number,inventory_code,order_number) del
+on a.style_number = del.itemNumber and b.inventory_code = del.inventoryCode and a.order_number = del.orderNumber
 where a.sy_shipping_order_item_id =#{id}
 group by c.group_id) t group by t.elementsId,t.styleNumber,t.smailPo,t.unitPrice order by t.supplier,t.salesman,t.styleNumber,t.smailPo,t.unitPrice