|
@@ -41,4 +41,166 @@
|
|
|
where om.cCode=#{sy.cCode}
|
|
|
</select>
|
|
|
|
|
|
+ <select id="queryOrderByCode" resultType="org.jeecg.modules.documents.orderData.entity.SyOrderData" >
|
|
|
+ <if test="sy.account =='901'">
|
|
|
+ SELECT
|
|
|
+ s.ID AS id,s.cSOCode AS orderNumber,s.dDate AS orderDate,s.cBusType AS businessTypeValue,
|
|
|
+ s.cSTCode AS salesTypeValue,t.cSTName AS salesTypeText,cc.cCusAbbName AS customerAbbreviation,
|
|
|
+ cc.cCusName AS customerName,s.iExchRate AS exchangeRate,de.cDepName AS salesDepartment,
|
|
|
+ pe.cPersonName AS salesman,s.cexch_name AS currencyText,s.cdefine2 AS brandSide,s.cdefine1 AS thirdParty,
|
|
|
+ s.cdefine3 AS customerOrderNumber,s.cdefine11 AS endCustomer,s.cCusCode AS customerCode,
|
|
|
+ s.fbookratio AS depositRatio,s.iMoney AS deposit,s.cMemo AS orderRemarks,
|
|
|
+ s.cDefine14 AS orderChangeDescription,s.cDefine12 AS garmentFactory,v.cVenCode AS garmentFactoryCode,
|
|
|
+ s.cDefine5 AS garmentNmb,s.cMemo AS memo,f.chdefine4 AS priceRemarks,f.chdefine1 AS collaborativeRoute,
|
|
|
+ y.cexch_code AS currencyValue,p.cPayName AS termOfPayment,'901' AS account
|
|
|
+ FROM
|
|
|
+ UFDATA_901_2021.dbo.SO_SOMain s
|
|
|
+ LEFT JOIN UFDATA_901_2021.dbo.SO_SOMain_extradefine f ON s.ID = f.ID
|
|
|
+ LEFT JOIN UFDATA_901_2021.dbo.SaleType t ON s.cSTCode = t.cSTCode
|
|
|
+ LEFT JOIN UFDATA_901_2021.dbo.foreigncurrency y ON s.cexch_name = y.cexch_name
|
|
|
+ LEFT JOIN UFDATA_901_2021.dbo.PayCondition p ON s.cPayCode = p.cPayCode
|
|
|
+ LEFT JOIN UFDATA_901_2021.dbo.Department de ON s.cDepCode = de.cDepCode
|
|
|
+ LEFT JOIN UFDATA_901_2021.dbo.Customer cc ON s.cCusCode = cc.cCusCode
|
|
|
+ LEFT JOIN UFDATA_901_2021.dbo.Person pe ON s.cPersonCode = pe.cPersonCode
|
|
|
+ LEFT JOIN UFDATA_901_2021.dbo.Vendor v ON s.cDefine12 = v.cVenName
|
|
|
+ WHERE
|
|
|
+ s.iStatus = 1
|
|
|
+ AND s.cSOCode = #{sy.orderNumber}
|
|
|
+ </if>
|
|
|
+ <if test="sy.account =='902'">
|
|
|
+ SELECT
|
|
|
+ s.ID AS id,s.cSOCode AS orderNumber,s.dDate AS orderDate,s.cBusType AS businessTypeValue,
|
|
|
+ s.cSTCode AS salesTypeValue,t.cSTName AS salesTypeText,cc.cCusAbbName AS customerAbbreviation,
|
|
|
+ cc.cCusName AS customerName,s.iExchRate AS exchangeRate,de.cDepName AS salesDepartment,
|
|
|
+ pe.cPersonName AS salesman,s.cexch_name AS currencyText,s.cdefine2 AS brandSide,s.cdefine1 AS thirdParty,
|
|
|
+ s.cdefine3 AS customerOrderNumber,s.cdefine11 AS endCustomer,s.cCusCode AS customerCode,
|
|
|
+ s.fbookratio AS depositRatio,s.iMoney AS deposit,s.cMemo AS orderRemarks,
|
|
|
+ s.cDefine14 AS orderChangeDescription,s.cDefine12 AS garmentFactory,v.cVenCode AS garmentFactoryCode,
|
|
|
+ s.cDefine5 AS garmentNmb,s.cMemo AS memo,f.chdefine4 AS priceRemarks,f.chdefine1 AS collaborativeRoute,
|
|
|
+ y.cexch_code AS currencyValue,p.cPayName AS termOfPayment,'902' AS account
|
|
|
+ FROM
|
|
|
+ UFDATA_902_2021.dbo.SO_SOMain s
|
|
|
+ LEFT JOIN UFDATA_902_2021.dbo.SO_SOMain_extradefine f ON s.ID = f.ID
|
|
|
+ LEFT JOIN UFDATA_902_2021.dbo.SaleType t ON s.cSTCode = t.cSTCode
|
|
|
+ LEFT JOIN UFDATA_902_2021.dbo.foreigncurrency y ON s.cexch_name = y.cexch_name
|
|
|
+ LEFT JOIN UFDATA_902_2021.dbo.PayCondition p ON s.cPayCode = p.cPayCode
|
|
|
+ LEFT JOIN UFDATA_902_2021.dbo.Department de ON s.cDepCode = de.cDepCode
|
|
|
+ LEFT JOIN UFDATA_902_2021.dbo.Customer cc ON s.cCusCode = cc.cCusCode
|
|
|
+ LEFT JOIN UFDATA_902_2021.dbo.Person pe ON s.cPersonCode = pe.cPersonCode
|
|
|
+ LEFT JOIN UFDATA_902_2021.dbo.Vendor v ON s.cDefine12 = v.cVenName
|
|
|
+ WHERE
|
|
|
+ s.iStatus = 1
|
|
|
+ AND s.cSOCode = #{sy.orderNumber}
|
|
|
+ </if>
|
|
|
+ <if test="sy.account =='903'">
|
|
|
+ SELECT
|
|
|
+ s.ID AS id,s.cSOCode AS orderNumber,s.dDate AS orderDate,s.cBusType AS businessTypeValue,
|
|
|
+ s.cSTCode AS salesTypeValue,t.cSTName AS salesTypeText,cc.cCusAbbName AS customerAbbreviation,
|
|
|
+ cc.cCusName AS customerName,s.iExchRate AS exchangeRate,de.cDepName AS salesDepartment,
|
|
|
+ pe.cPersonName AS salesman,s.cexch_name AS currencyText,s.cdefine2 AS brandSide,s.cdefine1 AS thirdParty,
|
|
|
+ s.cdefine3 AS customerOrderNumber,s.cdefine11 AS endCustomer,s.cCusCode AS customerCode,
|
|
|
+ s.fbookratio AS depositRatio,s.iMoney AS deposit,s.cMemo AS orderRemarks,
|
|
|
+ s.cDefine14 AS orderChangeDescription,s.cDefine12 AS garmentFactory,v.cVenCode AS garmentFactoryCode,
|
|
|
+ s.cDefine5 AS garmentNmb,s.cMemo AS memo,f.chdefine4 AS priceRemarks,f.chdefine1 AS collaborativeRoute,
|
|
|
+ y.cexch_code AS currencyValue,p.cPayName AS termOfPayment,'903' AS account
|
|
|
+ FROM
|
|
|
+ UFDATA_903_2021.dbo.SO_SOMain s
|
|
|
+ LEFT JOIN UFDATA_903_2021.dbo.SO_SOMain_extradefine f ON s.ID = f.ID
|
|
|
+ LEFT JOIN UFDATA_903_2021.dbo.SaleType t ON s.cSTCode = t.cSTCode
|
|
|
+ LEFT JOIN UFDATA_903_2021.dbo.foreigncurrency y ON s.cexch_name = y.cexch_name
|
|
|
+ LEFT JOIN UFDATA_903_2021.dbo.PayCondition p ON s.cPayCode = p.cPayCode
|
|
|
+ LEFT JOIN UFDATA_903_2021.dbo.Department de ON s.cDepCode = de.cDepCode
|
|
|
+ LEFT JOIN UFDATA_903_2021.dbo.Customer cc ON s.cCusCode = cc.cCusCode
|
|
|
+ LEFT JOIN UFDATA_903_2021.dbo.Person pe ON s.cPersonCode = pe.cPersonCode
|
|
|
+ LEFT JOIN UFDATA_903_2021.dbo.Vendor v ON s.cDefine12 = v.cVenName
|
|
|
+ WHERE
|
|
|
+ s.iStatus = 1
|
|
|
+ AND s.cSOCode = #{sy.orderNumber}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="queryOrderItemByCode" resultType="org.jeecg.modules.documents.orderData.entity.SyOrderDataItem" >
|
|
|
+ <if test="sy.account =='901'">
|
|
|
+ SELECT
|
|
|
+ s.AutoID AS id,s.ID AS syOrderDataId,s.cDefine22 AS itemNumber,s.dPreDate AS preDeliveryDate,
|
|
|
+ s.dPreMoDate AS preCompletionDate,s.cDefine32 AS packId,s.cDefine28 AS smallPo,
|
|
|
+ s.cDefine29 AS distributionPoint,s.cInvCode AS inventoryCode,c.cInvCcode AS inventoryCcode,
|
|
|
+ c.cInvName AS inventoryName,s.cFree1 AS colour,s.cFree2 AS size,s.cFree3 AS codingRules,
|
|
|
+ s.cFree4 AS guangpeiGateWidth,s.cFree6 AS weight,s.cDefine35 AS boxNumber,
|
|
|
+ s.iQuantity AS quantity,s.iQuantity AS surplusNum,s.iTaxUnitPrice AS unitPriceIncludingTax,
|
|
|
+ s.iSum AS totalPriceAndTax,s.iTaxRate AS taxRate,s.cMemo AS remarks,
|
|
|
+ d.cComUnitName AS masterMetering,c.cInvStd AS specificationAndModel,
|
|
|
+ CASE
|
|
|
+ WHEN c.cInvDefine14 IS NULL THEN 1 ELSE cInvDefine14 END
|
|
|
+ AS numberOfSets,
|
|
|
+ s.cSCloser AS bankClosedBy,be.cbdefine2 AS ymoney
|
|
|
+ FROM
|
|
|
+ UFDATA_901_2021.dbo.SO_SODetails s
|
|
|
+ JOIN UFDATA_901_2021.dbo.SO_SOMain sm on sm.id=s.id
|
|
|
+ LEFT JOIN UFDATA_901_2021.dbo.Inventory c ON c.cInvCode= s.cInvCode
|
|
|
+ LEFT JOIN UFDATA_901_2021.dbo.ComputationUnit d ON d.cComunitCode= c.cComUnitCode
|
|
|
+ LEFT JOIN UFDATA_901_2021.dbo.SO_SODetails_extradefine be ON be.iSOsID= s.iSOsID
|
|
|
+ WHERE
|
|
|
+ sm.csocode=#{sy.orderNumber} and sd.iRowNo=#{sy.iRowNo}
|
|
|
+ </if>
|
|
|
+ <if test="sy.account =='902'">
|
|
|
+ SELECT
|
|
|
+ s.AutoID AS id,s.ID AS syOrderDataId,s.cDefine22 AS itemNumber,s.dPreDate AS preDeliveryDate,
|
|
|
+ s.dPreMoDate AS preCompletionDate,s.cDefine32 AS packId,s.cDefine28 AS smallPo,
|
|
|
+ s.cDefine29 AS distributionPoint,s.cInvCode AS inventoryCode,c.cInvCcode AS inventoryCcode,
|
|
|
+ c.cInvName AS inventoryName,s.cFree1 AS colour,s.cFree2 AS size,s.cFree3 AS codingRules,
|
|
|
+ s.cFree4 AS guangpeiGateWidth,s.cFree6 AS weight,s.cDefine35 AS boxNumber,
|
|
|
+ s.iQuantity AS quantity,s.iQuantity AS surplusNum,s.iTaxUnitPrice AS unitPriceIncludingTax,
|
|
|
+ s.iSum AS totalPriceAndTax,s.iTaxRate AS taxRate,s.cMemo AS remarks,
|
|
|
+ d.cComUnitName AS masterMetering,c.cInvStd AS specificationAndModel,
|
|
|
+ CASE
|
|
|
+ WHEN c.cInvDefine14 IS NULL THEN 1 ELSE cInvDefine14 END
|
|
|
+ AS numberOfSets,
|
|
|
+ s.cSCloser AS bankClosedBy,be.cbdefine2 AS ymoney
|
|
|
+ FROM
|
|
|
+ UFDATA_902_2021.dbo.SO_SODetails s
|
|
|
+ JOIN UFDATA_902_2021.dbo.SO_SOMain sm on sm.id=s.id
|
|
|
+ LEFT JOIN UFDATA_902_2021.dbo.Inventory c ON c.cInvCode= s.cInvCode
|
|
|
+ LEFT JOIN UFDATA_902_2021.dbo.ComputationUnit d ON d.cComunitCode= c.cComUnitCode
|
|
|
+ LEFT JOIN UFDATA_902_2021.dbo.SO_SODetails_extradefine be ON be.iSOsID= s.iSOsID
|
|
|
+ WHERE
|
|
|
+ sm.csocode=#{sy.orderNumber} and sd.iRowNo=#{sy.iRowNo}
|
|
|
+ </if>
|
|
|
+ <if test="sy.account =='903'">
|
|
|
+ SELECT
|
|
|
+ s.AutoID AS id,s.ID AS syOrderDataId,s.cDefine22 AS itemNumber,s.dPreDate AS preDeliveryDate,
|
|
|
+ s.dPreMoDate AS preCompletionDate,s.cDefine32 AS packId,s.cDefine28 AS smallPo,
|
|
|
+ s.cDefine29 AS distributionPoint,s.cInvCode AS inventoryCode,c.cInvCcode AS inventoryCcode,
|
|
|
+ c.cInvName AS inventoryName,s.cFree1 AS colour,s.cFree2 AS size,s.cFree3 AS codingRules,
|
|
|
+ s.cFree4 AS guangpeiGateWidth,s.cFree6 AS weight,s.cDefine35 AS boxNumber,
|
|
|
+ s.iQuantity AS quantity,s.iQuantity AS surplusNum,s.iTaxUnitPrice AS unitPriceIncludingTax,
|
|
|
+ s.iSum AS totalPriceAndTax,s.iTaxRate AS taxRate,s.cMemo AS remarks,
|
|
|
+ d.cComUnitName AS masterMetering,c.cInvStd AS specificationAndModel,
|
|
|
+ CASE
|
|
|
+ WHEN c.cInvDefine14 IS NULL THEN 1 ELSE cInvDefine14 END
|
|
|
+ AS numberOfSets,
|
|
|
+ s.cSCloser AS bankClosedBy,be.cbdefine2 AS ymoney
|
|
|
+ FROM
|
|
|
+ UFDATA_903_2021.dbo.SO_SODetails s
|
|
|
+ JOIN UFDATA_903_2021.dbo.SO_SOMain sm on sm.id=s.id
|
|
|
+ LEFT JOIN UFDATA_903_2021.dbo.Inventory c ON c.cInvCode= s.cInvCode
|
|
|
+ LEFT JOIN UFDATA_903_2021.dbo.ComputationUnit d ON d.cComunitCode= c.cComUnitCode
|
|
|
+ LEFT JOIN UFDATA_903_2021.dbo.SO_SODetails_extradefine be ON be.iSOsID= s.iSOsID
|
|
|
+ WHERE
|
|
|
+ sm.csocode=#{sy.orderNumber} and sd.iRowNo=#{sy.iRowNo}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <update id="updateSO" >
|
|
|
+ <if test="sy.account =='901'">
|
|
|
+ UPDATE UFDATA_901_2021.dbo.SO_SOMain SET cdefine15 = '0' WHERE cSOCode = #{sy.orderNumber}
|
|
|
+ </if>
|
|
|
+ <if test="sy.account =='902'">
|
|
|
+ UPDATE UFDATA_902_2021.dbo.SO_SOMain SET cdefine15 = '0' WHERE cSOCode = #{sy.orderNumber}
|
|
|
+ </if>
|
|
|
+ <if test="sy.account =='903'">
|
|
|
+ UPDATE UFDATA_903_2021.dbo.SO_SOMain SET cdefine15 = '0' WHERE cSOCode = #{sy.orderNumber}
|
|
|
+ </if>
|
|
|
+ </update>
|
|
|
+
|
|
|
</mapper>
|