|  | @@ -4,38 +4,97 @@
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <select id="queryOrderData" resultType="org.jeecg.modules.documents.shippingDetails.entity.VO.OrderDataVo">
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        select b.sy_order_data_id as syOrderDataId,b.id as syOrderDataItemId ,a.order_number as orderNumber,b.item_number as itemNumber,b.small_po as smallPo,b.pk_org as pkOrg,a.order_date as orderDate,b.inventory_name as inventoryName,
 | 
	
		
			
				|  |  | -         b.colour as colour,b.size as size,b.coding_rules as codingRules,b.quantity as quantity,a.business_type_value as businessTypeText,a.customer_order_number as customerOrderNumber,
 | 
	
		
			
				|  |  | -           a.sales_type_text as salesTypeText,a.customer_abbreviation as customerAbbreviation,a.customer_name as customerName,b.surplus_num as surplusNum,
 | 
	
		
			
				|  |  | -           a.brand_side as brandSide,a.exchange_rate as exchangeRate,b.specification_and_model as specificationAndModel,a.account as account,
 | 
	
		
			
				|  |  | -           b.distribution_point as distributionPoint,pack_id as packId,a.supplier as supplier,b.unit_price_including_tax as unitPriceIncludingTax,
 | 
	
		
			
				|  |  | +        select b.sy_order_data_id as syOrderDataId,GROUP_CONCAT(b.id) as syOrderDataItemId ,a.order_number as orderNumber,b.item_number as itemNumber,b.small_po as smallPo,b.pk_org as pkOrg,a.order_date as orderDate,b.inventory_name as inventoryName,
 | 
	
		
			
				|  |  | +         b.colour as colour,b.size as size,b.coding_rules as codingRules,sum(b.quantity) as quantity,a.business_type_value as businessTypeText,a.customer_order_number as customerOrderNumber,
 | 
	
		
			
				|  |  | +           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,
 | 
	
		
			
				|  |  | +           b.supplier_code as supplierCode,a.garment_nmb as garmentNmb,a.garment_factory as garmentFactory,DATE_FORMAT(b.pre_delivery_date,'%Y-%m-%d') as preDeliveryDate,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,a.end_customer as endCustomer,
 | 
	
		
			
				|  |  | -             a.order_remarks as orderRemarks,a.price_remarks as priceRemarks,a.order_change_description as orderChangeDescription from sy_order_data a
 | 
	
		
			
				|  |  | -        left join sy_order_data_item b
 | 
	
		
			
				|  |  | -        on a.id = b.sy_order_data_id and b.del_flag = 0
 | 
	
		
			
				|  |  | +             a.order_remarks as orderRemarks,a.price_remarks as priceRemarks,a.order_change_description as orderChangeDescription,b.supplier as supplier,b.i_tax_price as iTaxPrice,
 | 
	
		
			
				|  |  | +             case when b.ymoney is null then '0' else b.ymoney end as ymoney,b.OMPO_id as OMPOId,b.inventory_ccode as inventoryCcode
 | 
	
		
			
				|  |  | +             from sy_order_data_item b
 | 
	
		
			
				|  |  | +        left join sy_order_data a
 | 
	
		
			
				|  |  | +        on a.id = b.sy_order_data_id
 | 
	
		
			
				|  |  |          ${ew.customSqlSegment}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +            AND b.inventory_ccode like '19%'
 | 
	
		
			
				|  |  | +        group by concat(a.order_number,a.customer_abbreviation,a.sales_department,a.salesman,a.account,b.pre_delivery_date,a.order_remarks,
 | 
	
		
			
				|  |  | +        b.item_number,b.small_po,b.inventory_name,b.colour,b.distribution_point,b.pack_id,b.coding_rules)
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <select id="queryOrderDataGarment" resultType="org.jeecg.modules.documents.shippingDetails.entity.VO.OrderDataVo">
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        select b.sy_order_data_id as syOrderDataId,GROUP_CONCAT(b.id) as syOrderDataItemId ,a.order_number as orderNumber,b.item_number as itemNumber,b.small_po as smallPo,b.pk_org as pkOrg,a.order_date as orderDate,b.inventory_name as inventoryName,
 | 
	
		
			
				|  |  | +         b.colour as colour,b.size as size,b.coding_rules as codingRules,sum(b.quantity) as quantity,a.business_type_value as businessTypeText,a.customer_order_number as customerOrderNumber,
 | 
	
		
			
				|  |  | +           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,
 | 
	
		
			
				|  |  | +           b.supplier_code as supplierCode,a.garment_nmb as garmentNmb,a.garment_factory as garmentFactory,DATE_FORMAT(b.pre_delivery_date,'%Y-%m-%d') as preDeliveryDate,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,a.end_customer as endCustomer,
 | 
	
		
			
				|  |  | +             a.order_remarks as orderRemarks,a.price_remarks as priceRemarks,a.order_change_description as orderChangeDescription,b.supplier as supplier,b.i_tax_price as iTaxPrice,
 | 
	
		
			
				|  |  | +             case when b.ymoney is null then '0' else b.ymoney end as ymoney,b.OMPO_id as OMPOId,b.inventory_ccode as inventoryCcode
 | 
	
		
			
				|  |  | +        from sy_order_data_item b
 | 
	
		
			
				|  |  | +        left join sy_order_data a
 | 
	
		
			
				|  |  | +        on a.id = b.sy_order_data_id
 | 
	
		
			
				|  |  | +        ${ew.customSqlSegment}
 | 
	
		
			
				|  |  | +            AND b.inventory_ccode not like '19%'
 | 
	
		
			
				|  |  | +         group by concat(a.order_number,a.customer_abbreviation,a.sales_department,a.salesman,a.account,b.pre_delivery_date,a.order_remarks,
 | 
	
		
			
				|  |  | +        b.item_number,b.small_po,b.inventory_name,b.colour,b.distribution_point,b.pack_id,b.coding_rules)
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    </select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  <select id="queryShippingDetails" resultType="org.jeecg.modules.documents.shippingDetails.entity.VO.SyShippingDetailsVo">
 | 
	
		
			
				|  |  | -    select t.* from(select a.id as id,a.document_no as documentNo,a.document_date as documentDate,b.order_number as orderNumber,a.push_state,a.state,
 | 
	
		
			
				|  |  | -    b.customer_abbreviation as customerAbbreviation,b.sales_department as salesDepartment,b.salesman as salesman,a.customer as customer,
 | 
	
		
			
				|  |  | -    b.small_po as smallPo,b.pack_id as packId,a.pre_delivery_date as preDeliveryDate,a.declaration_name as declarationName,b.order_date as orderDate,
 | 
	
		
			
				|  |  | +    select t.* from(select b.is_reference as isReference,a.id as id,GROUP_CONCAT(b.id) as itemIds,a.document_no as documentNo,a.document_date as documentDate,b.order_number as orderNumber,a.push_state,b.submit_status as submitStatus,
 | 
	
		
			
				|  |  | +    b.customer_abbreviation as customerAbbreviation,b.sales_department as salesDepartment,b.salesman as salesman,a.customer as customer,b.specification_and_model as specificationAndModel,
 | 
	
		
			
				|  |  | +    b.small_po as smallPo,b.pack_id as packId,b.pre_delivery_date as preDeliveryDate,a.declaration_name as declarationName,b.order_date as orderDate,
 | 
	
		
			
				|  |  |      sum(b.shipment_quantity) as shipmentQuantity,b.customs_declaration_unit_price as customsDeclarationUnitPrice,b.order_quantity as orderQuantity,
 | 
	
		
			
				|  |  |      b.is_tc as isTc,a.hs_code as hsCode,b.distribution_point as distributionPoint,b.item_number as itemNumber,b.business_type_text as businessTypeText,
 | 
	
		
			
				|  |  |      b.arrival_date as arrivalDate,b.inventory_name as inventoryName,b.sales_unit_price as salesUnitPrice,b.order_remaining_quantity as orderRemainingQuantity,
 | 
	
		
			
				|  |  |      b.pur_or_sub_order as purOrSubOrder,a.order_type as orderType,b.factory_unit_price as factoryUnitPrice,b.third_party as thirdParty,b.customer_order as customerOrder,
 | 
	
		
			
				|  |  |      b.material_composition as materialComposition,b.currency_text as currencyText,b.brand_side as brandSide,b.deposit_ratio as depositRatio,
 | 
	
		
			
				|  |  |      b.deposit as deposit,b.collaborative_route as collaborativeRoute,b.term_of_payment as termOfPayment,b.end_customer as endCustomer,
 | 
	
		
			
				|  |  | -    b.order_remarks as orderRemarks,b.price_remarks as priceRemarks,b.order_change_description as orderChangeDescription,a.pre_completion_date as preCompletionDate,
 | 
	
		
			
				|  |  | +    b.order_remarks as orderRemarks,b.price_remarks as priceRemarks,b.order_change_description as orderChangeDescription,b.pre_completion_date as preCompletionDate,
 | 
	
		
			
				|  |  |      b.sales_type_text as salesTypeText,b.customer_name as customerName,b.exchange_rate as exchangeRate,a.whole_order_total as wholeOrderTotal,
 | 
	
		
			
				|  |  | -    b.declaration_elements as declarationElements,b.number_of_sets as numberOfSets,a.chinese_name as chineseName,b.account as account,
 | 
	
		
			
				|  |  | -    a.english_product_name as englishProductName,a.garment_factory as garmentFactory from sy_shipping_details a
 | 
	
		
			
				|  |  | +    b.declaration_elements as declarationElements,b.number_of_sets as numberOfSets,a.chinese_name as chineseName,a.account as account,
 | 
	
		
			
				|  |  | +    a.english_product_name as englishProductName,b.garment_factory as garmentFactory,b.elements_id as elementsId from sy_shipping_details a
 | 
	
		
			
				|  |  |  left join sy_shipping_details_item b
 | 
	
		
			
				|  |  |  on a.id = b.shipping_details_id and b.del_flag = 0
 | 
	
		
			
				|  |  | -where a.del_flag = 0 group by a.id order by a.document_no desc) as t
 | 
	
		
			
				|  |  | +where a.del_flag = 0
 | 
	
		
			
				|  |  | +  AND b.inventory_ccode like '19%'
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +GROUP BY b.group_id
 | 
	
		
			
				|  |  | + order by a.document_no desc) as t
 | 
	
		
			
				|  |  | +${ew.customSqlSegment}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +</select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <select id="queryShippingDetailsGarment" resultType="org.jeecg.modules.documents.shippingDetails.entity.VO.SyShippingDetailsVo">
 | 
	
		
			
				|  |  | +    select t.* from(select b.is_reference as isReference,a.id as id,GROUP_CONCAT(b.id) as itemIds,a.document_no as documentNo,a.document_date as documentDate,b.order_number as orderNumber,a.push_state,b.submit_status as submitStatus,
 | 
	
		
			
				|  |  | +    b.customer_abbreviation as customerAbbreviation,b.sales_department as salesDepartment,b.salesman as salesman,a.customer as customer,b.specification_and_model as specificationAndModel,
 | 
	
		
			
				|  |  | +    b.small_po as smallPo,b.pack_id as packId,b.pre_delivery_date as preDeliveryDate,a.declaration_name as declarationName,b.order_date as orderDate,
 | 
	
		
			
				|  |  | +    sum(b.shipment_quantity) as shipmentQuantity,b.customs_declaration_unit_price as customsDeclarationUnitPrice,b.order_quantity as orderQuantity,
 | 
	
		
			
				|  |  | +    b.is_tc as isTc,a.hs_code as hsCode,b.distribution_point as distributionPoint,b.item_number as itemNumber,b.business_type_text as businessTypeText,
 | 
	
		
			
				|  |  | +    b.arrival_date as arrivalDate,b.inventory_name as inventoryName,b.sales_unit_price as salesUnitPrice,b.order_remaining_quantity as orderRemainingQuantity,
 | 
	
		
			
				|  |  | +    b.pur_or_sub_order as purOrSubOrder,a.order_type as orderType,b.factory_unit_price as factoryUnitPrice,b.third_party as thirdParty,b.customer_order as customerOrder,
 | 
	
		
			
				|  |  | +    b.material_composition as materialComposition,b.currency_text as currencyText,b.brand_side as brandSide,b.deposit_ratio as depositRatio,
 | 
	
		
			
				|  |  | +    b.deposit as deposit,b.collaborative_route as collaborativeRoute,b.term_of_payment as termOfPayment,b.end_customer as endCustomer,
 | 
	
		
			
				|  |  | +    b.order_remarks as orderRemarks,b.price_remarks as priceRemarks,b.order_change_description as orderChangeDescription,b.pre_completion_date as preCompletionDate,
 | 
	
		
			
				|  |  | +    b.sales_type_text as salesTypeText,b.customer_name as customerName,b.exchange_rate as exchangeRate,a.whole_order_total as wholeOrderTotal,
 | 
	
		
			
				|  |  | +    b.declaration_elements as declarationElements,b.number_of_sets as numberOfSets,a.chinese_name as chineseName,a.account as account,
 | 
	
		
			
				|  |  | +    a.english_product_name as englishProductName,b.garment_factory as garmentFactory,b.elements_id as elementsId from sy_shipping_details a
 | 
	
		
			
				|  |  | +left join sy_shipping_details_item b
 | 
	
		
			
				|  |  | +on a.id = b.shipping_details_id and b.del_flag = 0
 | 
	
		
			
				|  |  | +where a.del_flag = 0
 | 
	
		
			
				|  |  | +  AND b.inventory_ccode not like '19%'
 | 
	
		
			
				|  |  | +GROUP BY b.group_id
 | 
	
		
			
				|  |  | + order by a.document_no desc) as t
 | 
	
		
			
				|  |  |  ${ew.customSqlSegment}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  </select>
 | 
	
	
		
			
				|  | @@ -43,69 +102,44 @@ ${ew.customSqlSegment}
 | 
	
		
			
				|  |  |      <update id="syshippingDetailsItemUpdate">
 | 
	
		
			
				|  |  |          update sy_shipping_details_item
 | 
	
		
			
				|  |  |          set del_flag = '1'
 | 
	
		
			
				|  |  | -        where shipping_details_id = #{shippingDetailsId}
 | 
	
		
			
				|  |  | +        where id = #{shippingDetailsId}
 | 
	
		
			
				|  |  |      </update>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <select id="pushSyShipping" resultType="org.jeecg.modules.documents.shippingDetails.entity.VO.PushShippingVO">
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -        select account as tenantId,
 | 
	
		
			
				|  |  | -        id as accessoriesHeaderId,
 | 
	
		
			
				|  |  | -        document_no as packingHeaderNum,--'ACCESSORIES0609-2'
 | 
	
		
			
				|  |  | -        'ACCESSORIES' as packingType,
 | 
	
		
			
				|  |  | -        'NEW' as packingStatus,
 | 
	
		
			
				|  |  | -        --'PO36202206070001' as poNo,
 | 
	
		
			
				|  |  | -        --'JAZS001' as containerNumm,
 | 
	
		
			
				|  |  | -       --  '2022-06-07' as loadingDate,
 | 
	
		
			
				|  |  | -         '01000229' as supplierNumber,
 | 
	
		
			
				|  |  | -          --'' as invoiceNum,
 | 
	
		
			
				|  |  | -          create_by as preparer,
 | 
	
		
			
				|  |  | -          create_time as preparationTime
 | 
	
		
			
				|  |  | +        select
 | 
	
		
			
				|  |  | +        document_no as packingHeaderNum,--装箱单编号-(发运明细单号)
 | 
	
		
			
				|  |  | +        'ACCESSORIES' as packingType,--装箱单类型-(发运明细类型,默认ACCESSORIES)
 | 
	
		
			
				|  |  | +        'NEW' as packingStatus,--装箱单状态-(发运明细状态,默认NEW)
 | 
	
		
			
				|  |  | +         '01000229' as supplierNumber,--供应商编码(收货)(收货方供应商编码)
 | 
	
		
			
				|  |  | +          create_by as preparer,--制单人
 | 
	
		
			
				|  |  | +          create_time as preparationTime--制单时间
 | 
	
		
			
				|  |  |            from sy_shipping_details
 | 
	
		
			
				|  |  | -         where del_flag = 0 and id = #{id}
 | 
	
		
			
				|  |  | +          where del_flag = 0 and id = #{id}
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      <select id="pushSyShippingDeial" resultType="org.jeecg.modules.documents.shippingDetails.entity.VO.PushShippingDeialVo">
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |          select
 | 
	
		
			
				|  |  | -        --'103' as tenantId,
 | 
	
		
			
				|  |  | -         -- a.id as accessoriesLineId,
 | 
	
		
			
				|  |  | -          --id as accessoriesHeaderIdD,
 | 
	
		
			
				|  |  | -          a.sort as packingLineNum,
 | 
	
		
			
				|  |  | -          'T0036' as merchandiser,
 | 
	
		
			
				|  |  | -          a.order_number as poNo,--'PO36202206070001'
 | 
	
		
			
				|  |  | -          a.sy_order_data_id as moDetailId,
 | 
	
		
			
				|  |  | -           --'' as poId,
 | 
	
		
			
				|  |  | -          a.item_number as styleNo, --'W21-W20-MSP-SPW0001'
 | 
	
		
			
				|  |  | -         -- 'C156St2' as batchNo,
 | 
	
		
			
				|  |  | -           b.colour as color,
 | 
	
		
			
				|  |  | -           'N0201002139' as itemCode,
 | 
	
		
			
				|  |  | -           '' as itemId,
 | 
	
		
			
				|  |  | -          '全涤绒布' as itemDesc,
 | 
	
		
			
				|  |  | -          '针织布' as declarationName,
 | 
	
		
			
				|  |  | -          '全涤' as composition,
 | 
	
		
			
				|  |  | -          '190' as width,
 | 
	
		
			
				|  |  | -          '' as rolls,
 | 
	
		
			
				|  |  | -          '43' as planPackingQty,
 | 
	
		
			
				|  |  | -          '21' as actualPackingQty,
 | 
	
		
			
				|  |  | -          '33' as grossWeight,
 | 
	
		
			
				|  |  | -          '21' as netWeight,
 | 
	
		
			
				|  |  | -          '32' as length,
 | 
	
		
			
				|  |  | -          '' as clothWeight,
 | 
	
		
			
				|  |  | -          '12' as cartons,
 | 
	
		
			
				|  |  | -          '6.32' as unitPrice,
 | 
	
		
			
				|  |  | -          '45.21' as totalPrice,
 | 
	
		
			
				|  |  | -          '' as gramWeight,
 | 
	
		
			
				|  |  | -          '01000229' as supplierNumber,
 | 
	
		
			
				|  |  | -          '' as supplierId,
 | 
	
		
			
				|  |  | -          '' as supplierTenantId,
 | 
	
		
			
				|  |  | -          '打卷' as packingMethod,
 | 
	
		
			
				|  |  | -          a.treatment_method as treatmentMethod,
 | 
	
		
			
				|  |  | -          a.manual_yarn_flag as manualYarnFlag,
 | 
	
		
			
				|  |  | -          a.manual_yarn_unit_price as manualYarnUnitPrice,
 | 
	
		
			
				|  |  | -          a.manual_yarn_proportion as manualYarnProportion,
 | 
	
		
			
				|  |  | -          a.memo as remark,
 | 
	
		
			
				|  |  | +          a.sort as packingLineNum, -- 行号-(发运明细行号)
 | 
	
		
			
				|  |  | +          a.order_number as poNo,--计划单号-(订单号)
 | 
	
		
			
				|  |  | +          a.sy_order_data_id as moDetailId,--计划单号行ID-(订单号行ID(母件))
 | 
	
		
			
				|  |  | +          a.item_number as styleNo, --款号
 | 
	
		
			
				|  |  | +           b.colour as color,--颜色
 | 
	
		
			
				|  |  | +           a.inventory_code as itemCode,--物料编码-(存货编码)
 | 
	
		
			
				|  |  | +          a.inventory_name as itemDesc,--项目(辅料品名)-(存货名称)
 | 
	
		
			
				|  |  | +          '' as declarationName,--报关品名
 | 
	
		
			
				|  |  | +          a.material_composition as composition,--成分-(物料成分)
 | 
	
		
			
				|  |  | +          b.guangpei_gate_width as width,--门幅
 | 
	
		
			
				|  |  | +          '' as rolls,--匹数
 | 
	
		
			
				|  |  | +          a.shipment_quantity as planPackingQty,--计划装箱数量-(发货数量)
 | 
	
		
			
				|  |  | +          a.treatment_method as treatmentMethod,--处理方式
 | 
	
		
			
				|  |  | +          a.manual_yarn_flag as manualYarnFlag,--是否手册纱
 | 
	
		
			
				|  |  | +          a.manual_yarn_unit_price as manualYarnUnitPrice,--手册纱单价
 | 
	
		
			
				|  |  | +          a.manual_yarn_proportion as manualYarnProportion,--手册纱占比
 | 
	
		
			
				|  |  | +          a.memo as remark,--备注
 | 
	
		
			
				|  |  |            '111' as cabinetNum
 | 
	
		
			
				|  |  |            from sy_shipping_details_item a
 | 
	
		
			
				|  |  |            left join sy_order_data_item b
 | 
	
	
		
			
				|  | @@ -114,4 +148,84 @@ ${ew.customSqlSegment}
 | 
	
		
			
				|  |  |      </select>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    <select id="displayDetails" resultType="org.jeecg.modules.documents.shippingDetails.entity.VO.OrderDataVo">
 | 
	
		
			
				|  |  | +           select b.sy_order_data_id as syOrderDataId,b.id as syOrderDataItemId ,a.order_number as orderNumber,b.item_number as itemNumber,b.small_po as smallPo,b.pk_org as pkOrg,a.order_date as orderDate,b.inventory_name as inventoryName,
 | 
	
		
			
				|  |  | +         b.colour as colour,b.size as size,b.coding_rules as codingRules,b.quantity as quantity,a.business_type_value as businessTypeText,a.customer_order_number as customerOrderNumber,
 | 
	
		
			
				|  |  | +           a.sales_type_text as salesTypeText,a.customer_abbreviation as customerAbbreviation,a.customer_name as customerName,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,
 | 
	
		
			
				|  |  | +           b.supplier_code as supplierCode,a.garment_nmb as garmentNmb,a.garment_factory as garmentFactory,DATE_FORMAT(b.pre_delivery_date,'%Y-%m-%d') as preDeliveryDate,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,a.end_customer as endCustomer,
 | 
	
		
			
				|  |  | +             a.order_remarks as orderRemarks,a.price_remarks as priceRemarks,a.order_change_description as orderChangeDescription,b.supplier as supplier,b.i_tax_price as iTaxPrice,
 | 
	
		
			
				|  |  | +             case when b.ymoney is null then '0' else b.ymoney end as ymoney,b.OMPO_id as OMPOId,b.inventory_ccode as inventoryCcode
 | 
	
		
			
				|  |  | +             from sy_order_data a
 | 
	
		
			
				|  |  | +              left join sy_order_data_item b
 | 
	
		
			
				|  |  | +        on a.id = b.sy_order_data_id and b.del_flag = 0
 | 
	
		
			
				|  |  | +        ${ew.customSqlSegment}
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    </select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <select id="exCelQuery" resultType="org.jeecg.modules.documents.shippingDetails.entity.VO.SyShippingDetailsVo">
 | 
	
		
			
				|  |  | +          select t.* from(select a.id as id,a.document_no as documentNo,a.document_date as documentDate,b.order_number as orderNumber,a.push_state,a.state,
 | 
	
		
			
				|  |  | +    b.customer_abbreviation as customerAbbreviation,b.sales_department as salesDepartment,b.salesman as salesman,a.customer as customer,
 | 
	
		
			
				|  |  | +    b.small_po as smallPo,b.pack_id as packId,b.pre_delivery_date as preDeliveryDate,a.declaration_name as declarationName,b.order_date as orderDate,
 | 
	
		
			
				|  |  | +    b.shipment_quantity as shipmentQuantity,b.customs_declaration_unit_price as customsDeclarationUnitPrice,b.order_quantity as orderQuantity,
 | 
	
		
			
				|  |  | +    b.is_tc as isTc,a.hs_code as hsCode,b.distribution_point as distributionPoint,b.item_number as itemNumber,b.business_type_text as businessTypeText,
 | 
	
		
			
				|  |  | +    b.arrival_date as arrivalDate,b.inventory_name as inventoryName,b.sales_unit_price as salesUnitPrice,b.order_remaining_quantity as orderRemainingQuantity,
 | 
	
		
			
				|  |  | +    b.pur_or_sub_order as purOrSubOrder,a.order_type as orderType,b.factory_unit_price as factoryUnitPrice,b.third_party as thirdParty,b.customer_order as customerOrder,
 | 
	
		
			
				|  |  | +    b.material_composition as materialComposition,b.currency_text as currencyText,b.brand_side as brandSide,b.deposit_ratio as depositRatio,
 | 
	
		
			
				|  |  | +    b.deposit as deposit,b.collaborative_route as collaborativeRoute,b.term_of_payment as termOfPayment,b.end_customer as endCustomer,
 | 
	
		
			
				|  |  | +    b.order_remarks as orderRemarks,b.price_remarks as priceRemarks,b.order_change_description as orderChangeDescription,b.pre_completion_date as preCompletionDate,
 | 
	
		
			
				|  |  | +    b.sales_type_text as salesTypeText,b.customer_name as customerName,b.exchange_rate as exchangeRate,a.whole_order_total as wholeOrderTotal,
 | 
	
		
			
				|  |  | +    b.declaration_elements as declarationElements,b.number_of_sets as numberOfSets,a.chinese_name as chineseName,b.account as account,
 | 
	
		
			
				|  |  | +    a.english_product_name as englishProductName,b.garment_factory as garmentFactory from sy_shipping_details a
 | 
	
		
			
				|  |  | +left join sy_shipping_details_item b
 | 
	
		
			
				|  |  | +on a.id = b.shipping_details_id and b.del_flag = 0
 | 
	
		
			
				|  |  | +where a.del_flag = 0  order by a.document_no desc) as t
 | 
	
		
			
				|  |  | +${ew.customSqlSegment}
 | 
	
		
			
				|  |  | +    </select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <update id="updateElenmentId">
 | 
	
		
			
				|  |  | +        update sy_shipping_details_item b
 | 
	
		
			
				|  |  | +        left  join sy_shipping_details a
 | 
	
		
			
				|  |  | +        on b.shipping_details_id = a.id
 | 
	
		
			
				|  |  | +        set b.elements_id = #{elementsId}
 | 
	
		
			
				|  |  | +        where b.elements_id = #{id} and a.push_state = '0'
 | 
	
		
			
				|  |  | +    </update>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <update id="writeBackElenmentId">
 | 
	
		
			
				|  |  | +        update sy_shipping_details_item
 | 
	
		
			
				|  |  | +        set elements_id = #{elementsId}
 | 
	
		
			
				|  |  | +        where id in
 | 
	
		
			
				|  |  | +        <foreach collection="id" item="item"  open="(" separator="," close=")">
 | 
	
		
			
				|  |  | +            #{item}
 | 
	
		
			
				|  |  | +        </foreach>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    </update>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <update id="batchSubmission">
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        update sy_shipping_details_item
 | 
	
		
			
				|  |  | +        <if test='type == "1"'>
 | 
	
		
			
				|  |  | +            set submit_status = 1
 | 
	
		
			
				|  |  | +            where id in
 | 
	
		
			
				|  |  | +            <foreach collection="submitListId" item="item"  open="(" separator="," close=")">
 | 
	
		
			
				|  |  | +                #{item}
 | 
	
		
			
				|  |  | +            </foreach>
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        <if test='type == "2"'>
 | 
	
		
			
				|  |  | +            set submit_status = 0
 | 
	
		
			
				|  |  | +            where id in
 | 
	
		
			
				|  |  | +            <foreach collection="submitListId" item="item"  open="(" separator="," close=")">
 | 
	
		
			
				|  |  | +                #{item}
 | 
	
		
			
				|  |  | +            </foreach>
 | 
	
		
			
				|  |  | +        </if>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    </update>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  </mapper>
 |