| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.dk.mdm.mapper.ivt.OutboundMapper">
- <!-- 通用设置 -->
- <!-- 通用查询列 -->
- <sql id="Base_Column_List">
- out_id, out_no, out_type, from_id, from_no, org_id, staff_id, cus_id, sup_id,
- out_status, outing_qty, outing_amt, out_qty, out_amt, return_qty, return_amt,
- out_date, remarks, annex_paths, make_staff, make_time, receivable_id,
- flg_valid, cp_id,out_reason,flg_auto_handle,flg_handle_setting
- </sql>
- <sql id="Base_Column_List_Response">
- tpo.out_id, tpo.out_no, tpo.out_type, tpo.from_id, tpo.from_no, tpo.org_id, tpo.staff_id,
- tpo.cus_id, tpo.sup_id, tpo.out_status, tpo.outing_qty, tpo.outing_amt, tpo.out_qty, tpo.out_amt,
- tpo.return_qty, tpo.return_amt, tpo.out_date, tpo.remarks, tpo.annex_paths, tpo.make_staff,
- tpo.make_time, tpo.receivable_id, tpo.flg_valid, tpo.cp_id,tpo.out_reason,
- tpo.flg_auto_handle,tpo.flg_handle_setting
- </sql>
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.dk.mdm.model.pojo.ivt.Outbound">
- <id column="out_id" property="outId"/>
- <result column="out_no" property="outNo"/>
- <result column="out_type" property="outType"/>
- <result column="from_id" property="fromId" typeHandler="UuidTypeHandler"/>
- <result column="from_no" property="fromNo"/>
- <result column="org_id" property="orgId" typeHandler="UuidTypeHandler"/>
- <result column="staff_id" property="staffId" typeHandler="UuidTypeHandler"/>
- <result column="cus_id" property="cusId" typeHandler="UuidTypeHandler"/>
- <result column="sup_id" property="supId" typeHandler="UuidTypeHandler"/>
- <result column="out_status" property="outStatus"/>
- <result column="outing_qty" property="outingQty"/>
- <result column="outing_amt" property="outingAmt"/>
- <result column="out_qty" property="outQty"/>
- <result column="out_amt" property="outAmt"/>
- <result column="return_qty" property="returnQty"/>
- <result column="return_amt" property="returnAmt"/>
- <result column="out_date" property="outDate" typeHandler="TimestampTypeHandler"/>
- <result column="remarks" property="remarks"/>
- <result column="annex_paths" property="annexPaths" typeHandler="JsonTypeHandler"/>
- <result column="make_staff" property="makeStaff" typeHandler="UuidTypeHandler"/>
- <result column="make_time" property="makeTime" typeHandler="TimestampTypeHandler"/>
- <result column="receivable_id" property="receivableId" typeHandler="UuidTypeHandler"/>
- <result column="flg_valid" property="flgValid"/>
- <result column="cp_id" property="cpId"/>
- <result column="op_create_time" property="opCreateTime" typeHandler="TimestampTypeHandler"/>
- <result column="op_create_user_id" property="opCreateUserId" typeHandler="UuidTypeHandler"/>
- <result column="op_update_time" property="opUpdateTime" typeHandler="TimestampTypeHandler"/>
- <result column="op_update_user_id" property="opUpdateUserId" typeHandler="UuidTypeHandler"/>
- <result column="op_app_code" property="opAppCode"/>
- <result column="op_timestamp" property="opTimestamp" typeHandler="TimestampTypeHandler"/>
- <result column="op_db_user" property="opDbUser"/>
- <result column="out_reason" property="outReason" typeHandler="UuidTypeHandler"/>
- <result column="flg_auto_handle" property="flgAutoHandle"/>
- <result column="flg_handle_setting" property="flgHandleSetting"/>
- </resultMap>
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMapResponse" type="com.dk.mdm.model.response.ivt.OutboundResponse">
- <id column="out_id" property="outId"/>
- <result column="out_no" property="outNo"/>
- <result column="out_type" property="outType"/>
- <result column="from_id" property="fromId" typeHandler="UuidTypeHandler"/>
- <result column="from_no" property="fromNo"/>
- <result column="org_id" property="orgId" typeHandler="UuidTypeHandler"/>
- <result column="staff_id" property="staffId" typeHandler="UuidTypeHandler"/>
- <result column="cus_id" property="cusId" typeHandler="UuidTypeHandler"/>
- <result column="sup_id" property="supId" typeHandler="UuidTypeHandler"/>
- <result column="out_status" property="outStatus"/>
- <result column="outing_qty" property="outingQty"/>
- <result column="outing_amt" property="outingAmt"/>
- <result column="out_qty" property="outQty"/>
- <result column="out_amt" property="outAmt"/>
- <result column="return_qty" property="returnQty"/>
- <result column="return_amt" property="returnAmt"/>
- <result column="out_date" property="outDate" typeHandler="TimestampTypeHandler"/>
- <result column="remarks" property="remarks"/>
- <result column="annex_paths" property="annexPaths" typeHandler="JsonTypeHandler"/>
- <result column="make_staff" property="makeStaff" typeHandler="UuidTypeHandler"/>
- <result column="make_time" property="makeTime" typeHandler="TimestampTypeHandler"/>
- <result column="receivable_id" property="receivableId" typeHandler="UuidTypeHandler"/>
- <result column="flg_valid" property="flgValid"/>
- <result column="cp_id" property="cpId"/>
- <result column="flg_auto_handle" property="flgAutoHandle"/>
- <result column="flg_handle_setting" property="flgHandleSetting"/>
- <!-- <result column="org_name" property="orgName"/>-->
- <!-- <result column="staff_name" property="staffName"/>-->
- <result column="cusCode" property="cusCode"/>
- <result column="cusName" property="cusName"/>
- <result column="cusPhone" property="cusPhone"/>
- <result column="contact_phone" property="contactPhone"/>
- <result column="contact_name" property="contactName"/>
- <result column="address_area" property="addressArea" typeHandler="JsonTypeHandler"/>
- <result column="address_name" property="addressName"/>
- <result column="address_no" property="addressNo"/>
- <result column="address_gcj02" property="addressGcj02" typeHandler="JsonTypeHandler"/>
- <result column="addressFull" property="addressFull"/>
- <result column="channel_name" property="channelName"/>
- <result column="cus_from_name" property="cusFromName"/>
- <result column="out_reason" property="outReason" typeHandler="UuidTypeHandler"/>
- <result column="out_reason_name" property="outReasonName" />
- <result column="sumOutAmt" property="sumOutAmt" />
- <result column="sumOutQty" property="sumOutQty" />
- <result column="op_update_time" property="opUpdateTime" typeHandler="TimestampTypeHandler"/>
- </resultMap>
- <resultMap id="BaseResultMapDetailResponse" type="com.dk.mdm.model.response.ivt.OutboundResponse">
- <id column="out_id" property="outId"/>
- <result column="out_no" property="outNo"/>
- <result column="out_type" property="outType"/>
- <result column="from_id" property="fromId" typeHandler="UuidTypeHandler"/>
- <result column="from_no" property="fromNo"/>
- <result column="org_id" property="orgId" typeHandler="UuidTypeHandler"/>
- <result column="staff_id" property="staffId" typeHandler="UuidTypeHandler"/>
- <result column="staffName" property="staffName" />
- <result column="orgName" property="orgName" />
- <result column="cus_id" property="cusId" typeHandler="UuidTypeHandler"/>
- <result column="sup_id" property="supId" typeHandler="UuidTypeHandler"/>
- <result column="out_status" property="outStatus"/>
- <result column="outing_qty" property="outingQty"/>
- <result column="outing_amt" property="outingAmt"/>
- <result column="out_qty" property="outQty"/>
- <result column="out_amt" property="outAmt"/>
- <result column="return_qty" property="returnQty"/>
- <result column="return_amt" property="returnAmt"/>
- <result column="out_date" property="outDate" typeHandler="TimestampTypeHandler"/>
- <result column="remarks" property="remarks"/>
- <result column="annex_paths" property="annexPaths" typeHandler="JsonTypeHandler"/>
- <result column="make_staff" property="makeStaff" typeHandler="UuidTypeHandler"/>
- <result column="make_time" property="makeTime" typeHandler="TimestampTypeHandler"/>
- <result column="receivable_id" property="receivableId" typeHandler="UuidTypeHandler"/>
- <result column="flg_valid" property="flgValid"/>
- <result column="cp_id" property="cpId"/>
- <result column="flg_auto_handle" property="flgAutoHandle"/>
- <result column="flg_handle_setting" property="flgHandleSetting"/>
- <result column="cusCode" property="cusCode"/>
- <result column="cusName" property="cusName"/>
- <result column="cusPhone" property="cusPhone"/>
- <result column="contact_phone" property="contactPhone"/>
- <result column="contact_name" property="contactName"/>
- <result column="address_area" property="addressArea" typeHandler="JsonTypeHandler"/>
- <result column="address_name" property="addressName"/>
- <result column="address_no" property="addressNo"/>
- <result column="address_gcj02" property="addressGcj02" typeHandler="JsonTypeHandler"/>
- <result column="addressFull" property="addressFull"/>
- <result column="channel_name" property="channelName"/>
- <result column="cus_from_name" property="cusFromName"/>
- <result column="out_reason" property="outReason" typeHandler="UuidTypeHandler"/>
- <result column="out_reason_name" property="outReasonName" />
- <collection property="goodsList" resultMap="itemListMap" columnPrefix="list_"/>
- </resultMap>
- <resultMap id="itemListMap" type="java.util.Map">
- <id column="item_id" property="itemId"/>
- <result column="out_id" property="outId" typeHandler="UuidTypeHandler"/>
- <result column="out_no" property="outNo" />
- <result column="out_type" property="outType"/>
- <result column="from_id" property="fromId" typeHandler="UuidTypeHandler"/>
- <result column="from_item_id" property="fromItemId" typeHandler="UuidTypeHandler"/>
- <result column="item_index" property="itemIndex"/>
- <result column="sku_id" property="skuId" typeHandler="UuidTypeHandler"/>
- <result column="price_out" property="priceOut"/>
- <result column="non_std_code" property="nonStdCode"/>
- <result column="out_status" property="outStatus"/>
- <result column="outing_qty" property="outingQty"/>
- <result column="outing_amt" property="outingAmt"/>
- <result column="out_qty" property="outQty"/>
- <result column="out_amt" property="outAmt"/>
- <result column="return_qty" property="returnQty"/>
- <result column="return_amt" property="returnAmt"/>
- <result column="remarks" property="remarks"/>
- <result column="inv_id" property="invId" typeHandler="UuidTypeHandler"/>
- <result column="cost_price" property="costPrice"/>
- <result column="cost_amt" property="costAmt"/>
- <result column="flg_valid" property="flgValid"/>
- <result column="cp_id" property="cpId"/>
- <result column="s_out_id" property="sOutId" typeHandler="UuidTypeHandler"/>
- <result column="s_out_item_id" property="sOutItemId" typeHandler="UuidTypeHandler"/>
- <result column="s_order_id" property="sOrderId" typeHandler="UuidTypeHandler"/>
- <result column="s_order_item_id" property="sOrderItemId" typeHandler="UuidTypeHandler"/>
- <result column="sku_code" property="skuCode"/>
- <result column="sku_model" property="skuModel"/>
- <result column="sku_name" property="skuName"/>
- <result column="brand_name" property="brandName"/>
- <result column="price_purchase" property="pricePurchase"/>
- <result column="price_standard" property="priceStandard"/>
- <result column="sku_images" property="skuImages"/>
- <result column="wh_id" property="whId"/>
- <result column="wh_name" property="whName"/>
- </resultMap>
- <!-- 通用条件列 -->
- <sql id="Condition">
- <where>
- <if test="outNo != null and outNo != ''">
- AND t.out_no LIKE concat('%',my_ex.likequery(#{outNo}),'%')
- </if>
- <if test="outType != null and outType != ''">
- AND t.out_type = #{outType}
- </if>
- <if test="outTypeList != null and outTypeList.size()>0">
- AND t.out_type =any(#{outTypeList,typeHandler=StringListTypeHandler})
- </if>
- <if test="outReasonList != null and outReasonList.size()>0">
- AND t.out_reason =any(#{outReasonList,typeHandler=UuidListTypeHandler})
- </if>
- <if test="searchText !=null and searchText != ''">
- AND (
- t.out_no LIKE concat('%',my_ex.likequery(#{searchText}),'%')
- or t.from_no LIKE concat('%',my_ex.likequery(#{searchText}),'%')
- or tmc.cus_phone LIKE concat('%',my_ex.likequery(#{searchText}),'%')
- or tmc.cus_name LIKE concat('%',my_ex.likequery(#{searchText}),'%')
- or tmo.org_name LIKE concat('%',my_ex.likequery(#{searchText}),'%')
- or tmp.sup_name LIKE concat('%',my_ex.likequery(#{searchText}),'%')
- or tms.staff_name LIKE concat('%',my_ex.likequery(#{searchText}),'%')
- )
- </if>
- <if test="orgName != null and orgName != ''">
- AND tmo.org_name LIKE concat('%',my_ex.likequery(#{orgName}),'%')
- </if>
- <if test="addressFull != null and addressFull != ''">
- AND tmc.address_full LIKE concat('%',my_ex.likequery(#{addressFull}),'%')
- </if>
- <if test="supName != null and supName != ''">
- AND tmp.sup_name LIKE concat('%',my_ex.likequery(#{supName}),'%')
- </if>
- <if test="staffName != null and staffName != ''">
- AND tms.staff_name LIKE concat('%',my_ex.likequery(#{staffName}),'%')
- </if>
- <if test="fromId != null and fromId != ''">
- AND t.from_id = #{fromId}
- </if>
- <if test="fromNo != null and fromNo != ''">
- AND t.from_no = #{fromNo}
- </if>
- <if test="orgId != null and orgId != ''">
- AND t.org_id = #{orgId}
- </if>
- <if test="staffId != null and staffId != ''">
- AND t.staff_id = #{staffId}
- </if>
- <if test="cusId != null and cusId != ''">
- AND t.cus_id = #{cusId}::uuid
- </if>
- <if test="supId != null and supId != ''">
- AND t.sup_id = #{supId}
- </if>
- <if test="outStatus != null and outStatus != ''">
- AND t.out_status = #{outStatus}
- </if>
- <if test="outingQty != null">
- AND t.outing_qty = #{outingQty}
- </if>
- <if test="outingAmt != null">
- AND t.outing_amt = #{outingAmt}
- </if>
- <if test="outQty != null">
- AND t.out_qty = #{outQty}
- </if>
- <if test="outAmt != null">
- AND t.out_amt = #{outAmt}
- </if>
- <if test="returnQty != null">
- AND t.return_qty = #{returnQty}
- </if>
- <if test="returnAmt != null">
- AND t.return_amt = #{returnAmt}
- </if>
- <if test="remarks != null and remarks != ''">
- AND t.remarks = #{remarks}
- </if>
- <if test="annexPaths != null and annexPaths != ''">
- AND t.annex_paths = #{annexPaths}
- </if>
- <if test="makeStaff != null and makeStaff != ''">
- AND t.make_staff = #{makeStaff}
- </if>
- <if test="receivableId != null and receivableId != ''">
- AND t.receivable_id = #{receivableId}
- </if>
- <if test="cpId != null">
- AND t.cp_id = #{cpId}
- </if>
- <if test="orderNo != null and orderNo != ''">
- AND t.from_no LIKE concat('%',my_ex.likequery(#{orderNo}),'%')
- </if>
- <if test="cusPhone != null and cusPhone != ''">
- AND tmc.cus_phone LIKE concat('%',my_ex.likequery(#{cusPhone}),'%')
- </if>
- <if test="cusName != null and cusName != ''">
- AND tmc.cus_name LIKE concat('%',my_ex.likequery(#{cusName}),'%')
- </if>
- <if test="orgIdList != null and orgIdList.size() > 0">
- AND t.org_id =any(#{orgIdList, typeHandler=uuidListTypeHandler})
- </if>
- <if test="staffIdList != null and staffIdList.size() > 0">
- AND t.staff_id =any(#{staffIdList, typeHandler=uuidListTypeHandler})
- </if>
- <if test="outStatusList != null and outStatusList.size() > 0">
- AND t.out_status =any(#{outStatusList, typeHandler=StringListTypeHandler})
- </if>
- <if test="outDateStart != null and outDateEnd != null">
- AND t.out_date >= #{outDateStart}::timestamp with time zone
- AND t.out_date < #{outDateEnd}::timestamp with time zone + interval '1 day'
- </if>
- <if test="makeTimeStart != null and makeTimeEnd != null">
- AND t.make_time >= #{makeTimeStart}::timestamp with time zone
- AND t.make_time < #{makeTimeEnd}::timestamp with time zone + interval '1 day'
- </if>
- <if test="flgValidList != null and flgValidList.size()>0">
- AND t.flg_valid =any(#{flgValidList, typeHandler=BooleanListTypeHandler})
- </if>
- <if test="viewVoidedDocuments !=null and viewVoidedDocuments == false">
- AND t.flg_valid = true
- </if>
- </where>
- </sql>
- <sql id="idsForeach">
- <!-- 根据主键outId批量操作 -->
- WHERE out_id in
- <foreach collection="ids" index="index" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </sql>
- <!-- 查询表dkic_b.t_psi_outbound,(条件查询+分页)列表 -->
- <select id="selectByCond" resultMap="BaseResultMapResponse">
- SELECT t.out_id,
- t.out_no,
- t.out_type,
- t.from_id,
- t.from_no,
- t.from_no as "biznisNo",
- t.org_id,
- tmo.org_name as "orgName",
- t.staff_id,
- tms.staff_name as "staffName",
- t.cus_id,
- tmc.cus_code as "cusCode",
- tmc.cus_name as "cusName",
- tmc.cus_phone as "cusPhone",
- tmc.cus_from as "cusFrom",
- tmc.contact_phone as "contactPhone",
- tmc.address_full as "addressFull",
- tmdd.data_value as cus_from_name,
- t.sup_id,
- tmp.sup_name AS "supplierName",
- t.out_status,
- sys.f_get_name_i18n(tdk1.kind_name_i18n, #{i18n}) as "outStatusName",
- sys.f_get_name_i18n(tdktype.kind_name_i18n, #{i18n}) AS "outTypeName",
- t.outing_qty,
- t.outing_amt,
- (t.outing_amt + t.out_amt) AS "sumOutAmt",
- (t.outing_qty + t.out_qty) AS "sumOutQty",
- t.out_qty,
- t.out_amt,
- t.return_qty,
- t.return_amt,
- t.out_date,
- t.remarks,
- t.annex_paths,
- t.make_staff,
- makestaff.staff_name as "makeStaffName",
- t.make_time,
- t.receivable_id,
- t.cp_id,
- t.flg_valid,
- tmd.data_value as out_reason_name
- FROM dkic_b.t_psi_outbound as t
- left join dkic_b.t_mst_org tmo on tmo.org_id = t.org_id
- Left join dkic_b.t_mst_supplier tmp on tmp.sup_id = t.sup_id
- left join dkic_b.t_mst_staff tms on tms.staff_id = t.staff_id
- left join dkic_b.t_mst_staff as makestaff on makestaff.staff_id = t.make_staff
- left join dkic_b.t_mst_customer tmc on tmc.cus_id = t.cus_id
- left join dkic_b.t_mst_dictionary_data tmdd on tmdd.data_id = tmc.cus_from
- left join sys.t_data_kind as tdk1 on tdk1.kind_code = t.out_status
- LEFT JOIN sys.t_data_kind tdktype ON tdktype.kind_code = t.out_type
- left join dkic_b.t_mst_dictionary_data tmd on tmd.data_id = t.out_reason
- <include refid="Condition"/>
- order by t.make_time desc
- <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
- limit #{end} offset #{start}
- </if>
- </select>
- <!-- 查询表dkic_b.t_psi_outbound,(条件查询)个数 -->
- <select id="countByCond" resultType="Long">
- SELECT
- count(1)
- FROM dkic_b.t_psi_outbound as t
- left join dkic_b.t_mst_org tmo on tmo.org_id = t.org_id
- Left join dkic_b.t_mst_supplier tmp on tmp.sup_id = t.sup_id
- left join dkic_b.t_mst_staff tms on tms.staff_id = t.staff_id
- left join dkic_b.t_mst_staff as makestaff on makestaff.staff_id = t.make_staff
- left join dkic_b.t_mst_customer tmc on tmc.cus_id = t.cus_id
- left join dkic_b.t_mst_dictionary_data tmdd on tmdd.data_id = tmc.cus_from
- left join sys.t_data_kind as tdk1 on tdk1.kind_code = t.out_status
- LEFT JOIN sys.t_data_kind tdktype ON tdktype.kind_code = t.out_type
- left join dkic_b.t_mst_dictionary_data tmd on tmd.data_id = t.out_reason
- <include refid="Condition"/>
- </select>
- <!-- 根据主键查询表dkic_b.t_psi_outbound的一行数据 -->
- <select id="selectById" resultMap="BaseResultMapResponse">
- SELECT t.out_id,
- t.out_no,
- t.out_type,
- t.from_id,
- t.from_no,
- t.from_no as "orderNo",
- t.org_id,
- tmo.org_name as "orgName",
- t.staff_id,
- tms.staff_name as "staffName",
- t.cus_id,
- tmc.cus_code as "cusCode",
- tmc.cus_name as "cusName",
- tmc.cus_phone as "cusPhone",
- tmc.cus_from as "cusFrom",
- tmc.contact_phone as "contactPhone",
- tmc.address_full as "addressFull",
- tmdd.data_value as cus_from_name,
- tmc.address_area,
- tmc.address_name,
- tmc.address_no,
- tmc.address_gcj02,
- tmc.address_full,
- tmc.contact_name,
- tmc.contact_phone,
- tmc.channel_id as sales_channel,
- tmsc.channel_name as channel_name,
- t.sup_id,
- t.out_status,
- sys.f_get_name_i18n(tdk1.kind_name_i18n, #{i18n}) as "outStatusName",
- t.outing_qty,
- t.outing_amt,
- t.out_qty,
- t.out_amt,
- t.return_qty,
- t.return_amt,
- t.out_date,
- t.remarks,
- t.annex_paths,
- t.make_staff,
- makestaff.staff_name as "makeStaffName",
- t.make_time,
- t.receivable_id,
- t.cp_id,
- t.flg_valid,
- tmp.sup_name AS "supplierName",
- t.out_reason,
- t.flg_auto_handle,
- t.flg_handle_setting,
- tmd.data_value as out_reason_name
- FROM dkic_b.t_psi_outbound as t
- left join dkic_b.t_mst_customer tmc on tmc.cus_id = t.cus_id
- left join dkic_b.t_mst_sale_channel tmsc on tmsc.channel_id = tmc.channel_id
- left join dkic_b.t_mst_org tmo on tmo.org_id = t.org_id
- left join dkic_b.t_mst_staff tms on tms.staff_id = t.staff_id
- left join dkic_b.t_mst_staff as makestaff on makestaff.staff_id = t.make_staff
- left join dkic_b.t_mst_dictionary_data tmdd on tmdd.data_id = tmc.cus_from
- left join sys.t_data_kind as tdk1 on tdk1.kind_code = t.out_status
- left join dkic_b.t_mst_dictionary_data tmd on tmd.data_id = t.out_reason
- Left join dkic_b.t_mst_supplier tmp on tmp.sup_id = t.sup_id
- WHERE t.out_id = #{id}::uuid
- </select>
- <!-- 获取出库信息(新建退货用) -->
- <select id="selectByIdForReturn" resultMap="BaseResultMapResponse">
- SELECT t.out_id,
- t.out_no,
- t.out_type,
- t.from_id,
- t.from_no,
- t.from_no as "orderNo",
- t.org_id,
- tmo.org_name as "orgName",
- t.staff_id,
- tms.staff_name as "staffName",
- t.cus_id,
- tmc.cus_code as "cusCode",
- tmc.cus_name as "cusName",
- tmc.cus_phone as "cusPhone",
- tmc.cus_from as "cusFrom",
- tmc.contact_phone as "contactPhone",
- tmc.address_full as "addressFull",
- tmdd.data_value as cus_from_name,
- tmc.address_area,
- tmc.address_name,
- tmc.address_no,
- tmc.address_gcj02,
- tmc.address_full,
- tmc.contact_name,
- tmc.contact_phone,
- tmc.channel_id as sales_channel,
- tmsc.channel_name as channel_name,
- t.sup_id,
- t.out_status,
- sys.f_get_name_i18n(tdk1.kind_name_i18n, #{i18n}) as "outStatusName",
- t.outing_qty,
- t.outing_amt,
- t.out_qty,
- t.out_amt,
- t.return_qty,
- t.return_amt,
- t.out_date,
- t.remarks,
- t.annex_paths,
- t.make_staff,
- makestaff.staff_name as "makeStaffName",
- t.make_time,
- t.receivable_id,
- t.cp_id,
- t.flg_valid,
- tmd.data_value as out_reason_name
- FROM dkic_b.t_psi_outbound as t
- left join dkic_b.t_mst_customer tmc on tmc.cus_id = t.cus_id
- left join dkic_b.t_mst_sale_channel tmsc on tmsc.channel_id = tmc.channel_id
- left join dkic_b.t_mst_org tmo on tmo.org_id = t.org_id
- left join dkic_b.t_mst_staff tms on tms.staff_id = t.staff_id
- left join dkic_b.t_mst_staff as makestaff on makestaff.staff_id = t.make_staff
- left join dkic_b.t_mst_dictionary_data tmdd on tmdd.data_id = tmc.cus_from
- left join sys.t_data_kind as tdk1 on tdk1.kind_code = t.out_status
- left join dkic_b.t_mst_dictionary_data tmd on tmd.data_id = t.out_reason
- WHERE t.out_id = #{id}::uuid
- </select>
- <!-- 根据主键锁定表dkic_b.t_psi_outbound的一行数据 -->
- <select id="selectByIdForUpdate" resultMap="BaseResultMap">
- SELECT
- <include refid="Base_Column_List"/>
- FROM dkic_b.t_psi_outbound
- WHERE out_id = #{id}::uuid
- for update
- </select>
- <!-- 根据主键锁定表dkic_b.t_psi_outbound的多行数据 -->
- <select id="selectByIdsForUpdate" resultMap="BaseResultMap">
- SELECT
- <include refid="Base_Column_List"/>
- FROM dkic_b.t_psi_outbound
- <include refid="idsForeach"/>
- for update
- </select>
- <insert id="insertBatch">
- insert into dkic_b.t_psi_outbound
- (
- <trim suffixOverrides=",">
- out_no,
- out_type,
- from_id,
- from_no,
- org_id,
- staff_id,
- order_id,
- order_no,
- into_return_id,
- into_return_no,
- cus_id,
- sup_id,
- out_status,
- outing_qty,
- outing_amt,
- out_qty,
- out_amt,
- return_qty,
- return_amt,
- out_date,
- remarks,
- annex_paths,
- make_staff,
- make_time,
- receivable_id,
- cp_id,
- op_app_code,
- </trim>
- )
- values
- <foreach collection="list" index="index" item="item" separator=",">
- (
- <trim suffixOverrides=",">
- #{item.outNo},
- #{item.outType},
- #{item.fromId}::uuid,
- #{item.fromNo},
- #{item.orgId}::uuid,
- #{item.staffId}::uuid,
- #{item.cusId}::uuid,
- #{item.supId}::uuid,
- #{item.outStatus},
- #{item.outingQty},
- #{item.outingAmt},
- #{item.outQty},
- #{item.outAmt},
- #{item.returnQty},
- #{item.returnAmt},
- #{item.outDate},
- #{item.remarks},
- #{item.annexPaths},
- #{item.makeStaff}::uuid,
- #{item.makeTime},
- #{item.receivableId}::uuid,
- #{item.cpId},
- #{item.opAppCode},
- </trim>
- )
- </foreach>
- </insert>
- <!-- 根据id查询带出销售退货单数据(销售退货出库办理用)-->
- <select id="selectMessageByOtherQuery" resultMap="BaseResultMapResponse">
- SELECT
- <include refid="Base_Column_List_Response"/>
- ,tmo.org_name
- ,tms.staff_name as "staffName"
- ,tmc.cus_code
- ,tmc.cus_name
- ,tmc.cus_phone
- ,tmc.contact_phone
- ,tmc.contact_name
- ,tmc.address_area
- ,tmc.address_name
- ,tmc.address_no
- ,tmc.address_gcj02
- ,tmc.address_full
- ,tmsc.channel_name
- ,tmsc.channel_name
- ,tmsc.channel_name
- ,tmd.data_value as cus_from_name
- FROM dkic_b.t_psi_outbound tpo
- Left join dkic_b.t_mst_org tmo on tmo.org_id = tpo.org_id
- Left join dkic_b.t_mst_staff tms on tms.staff_id = tpo.staff_id
- left join dkic_b.t_mst_customer tmc on tpo.cus_id = tmc.cus_id
- left join dkic_b.t_mst_sale_channel tmsc on tmc.channel_id = tmsc.channel_id
- left join dkic_b.t_mst_dictionary_data tmd on tmc.cus_from = tmd.data_id
- <where>
- <if test="outId != null and outId != ''">
- AND tpo.out_id = #{outId}::uuid
- </if>
- <if test="outStatus != null and outStatus != ''">
- AND tpo.out_status = #{outStatus}
- </if>
- </where>
- </select>
- <!--修改退货信息 -->
- <update id="updateReturnMessage" parameterType="com.dk.mdm.model.pojo.sale.OrderItem">
- update dkic_b.t_psi_outbound
- <set>
- <if test="returnQty != null">
- return_qty = return_qty + #{returnQty,jdbcType=NUMERIC},
- </if>
- <if test="returnAmt != null">
- return_amt = return_amt + #{returnAmt,jdbcType=NUMERIC},
- </if>
- </set>
- where out_id = #{outId,typeHandler=UuidTypeHandler}
- and out_qty >= return_qty
- </update>
- <!-- 出库办理显示字段 -->
- <sql id="Base_Column_List_Response_Out">
- tpo.out_id ,
- tpo.out_no ,
- tpo.out_type ,
- tpo.from_id,
- tpo.from_no,
- tpo.org_id,
- tpo.staff_id,
- tpo.cus_id,
- tpo.sup_id,
- tpo.out_status,
- tpo.outing_qty ,
- tpo.outing_amt,
- tpo.out_qty ,
- tpo.out_amt ,
- tpo.return_qty,
- tpo.return_amt,
- tpo.out_date ,
- tpo.remarks,
- tpo.annex_paths,
- tpo.make_staff,
- tpo.make_time,
- tpo.out_reason,
- tpo.flg_valid,
- tpo.flg_auto_handle,
- tpo.flg_handle_setting,
- tpo.op_update_time
- </sql>
- <sql id="Base_Column_List_Response_Into">
- tpi.into_id as out_id,
- tpi.into_no as out_no,
- tpi.into_type as out_type,
- tpi.from_id,
- tpi.from_no,
- tpi.org_id,
- tpi.staff_id,
- tpi.cus_id,
- tpi.sup_id,
- tpi.into_status as out_status ,
- tpi.intoing_qty as outing_qty ,
- tpi.intoing_amt as outing_amt ,
- tpi.into_qty as out_qty ,
- tpi.into_amt as out_amt,
- tpi.return_qty,
- tpi.return_amt,
- tpi.into_date as out_date,
- tpi.remarks,
- tpi.annex_paths,
- tpi.make_staff,
- tpi.make_time,
- tpi.into_reason as out_reason,
- tpi.flg_valid,
- tpi.flg_auto_handle,
- tpi.flg_handle_setting,
- tpi.op_update_time
- </sql>
- <!-- 条件查询 web端入库办理用,-->
- <select id="selectOutbound" resultMap="BaseResultMapResponse">
- select * from (
- select
- <include refid="Base_Column_List_Response_Out"/>,
- tmo.org_name AS "orgName",
- tmp.sup_name AS "supplierName",
- tms.staff_name AS "staffName",
- tms.staff_name AS "makeStaffName",
- tmc.cus_name as "cusName",
- tmc.cus_phone as "cusPhone",
- tmc.cus_from as "cusFrom",
- makestaff.staff_name as "makeStaffName",
- sys.f_get_name_i18n(tdktype.kind_name_i18n, #{i18n}) AS "outTypeName",
- sys.f_get_name_i18n(tdk.kind_name_i18n, #{i18n}) AS "outStatusName",
- tmd.data_value as out_reason_name
- from dkic_b.t_psi_outbound tpo
- <include refid="Select_Inbound_Join_Table_Out"/>
- <where>
- AND tpo.cp_id = #{cpId}
- <if test="outTypes != null and outTypes.size()>0">
- AND tpo.out_type =any(#{outTypes,typeHandler=StringListTypeHandler})
- </if>
- <if test="outTypes == null || outTypes.size()==0">
- AND (tpo.out_type = '出库类型-其他出库'
- or tpo.out_type = '出库类型-销售出库')
- </if>
- <if test="outStatus != null and outStatus != '' ">
- AND tpo.out_status LIKE concat('%',my_ex.likequery(#{outStatus}),'%')
- </if>
- <if test="makeTimeStart != null and makeTimeEnd != null">
- AND tpo.make_time >= #{makeTimeStart}::timestamp with time zone
- AND tpo.make_time < #{makeTimeEnd}::timestamp with time zone + interval '1 day'
- </if>
- <if test="outNo != null and outNo != ''">
- AND tpo.out_no LIKE concat('%',my_ex.likequery(#{outNo}),'%')
- </if>
- <if test="cusPhone != null and cusPhone != ''">
- AND tmc.cus_phone LIKE concat('%',my_ex.likequery(#{cusPhone}),'%')
- </if>
- <if test="cusName != null and cusName != ''">
- AND tmc.cus_name LIKE concat('%',my_ex.likequery(#{cusName}),'%')
- </if>
- <if test="supId != null and supId != ''">
- AND tpo.sup_id = #{supId}::uuid
- </if>
- <if test="orgIdList != null and orgIdList.size() > 0">
- AND tmo.org_id =any(#{orgIdList, typeHandler=uuidListTypeHandler})
- </if>
- <if test="staffIdList != null and staffIdList.size() > 0">
- AND tms.staff_id =any(#{staffIdList, typeHandler=uuidListTypeHandler})
- </if>
- <if test="flgValidList != null and flgValidList.size()>0">
- AND tpo.flg_valid =any(#{flgValidList, typeHandler=BooleanListTypeHandler})
- </if>
- </where>
- union all
- SELECT
- <include refid="Base_Column_List_Response_Into"/>,
- tmo.org_name AS "orgName",
- tmp.sup_name AS "supplierName",
- tms.staff_name AS "staffName",
- tms.staff_name AS "makeStaffName",
- tmc.cus_name as "cusName",
- tmc.cus_phone as "cusPhone",
- tmc.cus_from as "cusFrom",
- makestaff.staff_name as "makeStaffName",
- sys.f_get_name_i18n(tdktype.kind_name_i18n, #{i18n}) AS "outTypeName",
- sys.f_get_name_i18n(tdk.kind_name_i18n, #{i18n}) AS "outStatusName",
- tmd.data_value as out_reason_name
- FROM dkic_b.t_psi_inbound tpi
- <include refid="Select_Inbound_Join_Table_Into"/>
- <where>
- AND tpi.cp_id = #{cpId}
- <if test="outTypes != null and outTypes.size()>0">
- AND tpi.into_type =any(#{outTypes,typeHandler=StringListTypeHandler})
- </if>
- <if test="outTypes == null || outTypes.size()==0">
- AND tpi.into_type = '入库类型-采退入库'
- </if>
- <if test="intoStatus != null and intoStatus != '' ">
- AND tpi.into_status LIKE concat('%',my_ex.likequery(#{intoStatus}),'%')
- </if>
- <if test="makeTimeStart != null and makeTimeEnd != null">
- AND tpi.make_time >= #{makeTimeStart}::timestamp with time zone
- AND tpi.make_time < #{makeTimeEnd}::timestamp with time zone + interval '1 day'
- </if>
- <if test="outNo != null and outNo != ''">
- AND tpi.into_no LIKE concat('%',my_ex.likequery(#{outNo}),'%')
- </if>
- <if test="cusPhone != null and cusPhone != ''">
- AND tmc.cus_phone LIKE concat('%',my_ex.likequery(#{cusPhone}),'%')
- </if>
- <if test="cusName != null and cusName != ''">
- AND tmc.cus_name LIKE concat('%',my_ex.likequery(#{cusName}),'%')
- </if>
- <if test="supId != null and supId != ''">
- AND tpi.sup_id = #{supId}::uuid
- </if>
- <if test="orgIdList != null and orgIdList.size() > 0">
- AND tmo.org_id =any(#{orgIdList, typeHandler=uuidListTypeHandler})
- </if>
- <if test="staffIdList != null and staffIdList.size() > 0">
- AND tms.staff_id =any(#{staffIdList, typeHandler=uuidListTypeHandler})
- </if>
- <if test="flgValidList != null and flgValidList.size()>0">
- AND tpi.flg_valid =any(#{flgValidList, typeHandler=BooleanListTypeHandler})
- </if>
- </where>
- ) tt order by tt.op_update_time desc
- <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
- limit #{end} offset #{start}
- </if>
- </select>
- <!-- 条件查询 web端入库办理用个数 -->
- <select id="selectOutboundCond" resultType="Long">
- SELECT
- count(1) from (
- select
- <include refid="Base_Column_List_Response_Out"/>,
- tmo.org_name AS "orgName",
- tmp.sup_name AS "supplierName",
- tms.staff_name AS "staffName",
- tms.staff_name AS "makeStaffName",
- tmc.cus_name as "cusName",
- tmc.cus_phone as "cusPhone",
- tmc.cus_from as "cusFrom",
- makestaff.staff_name as "makeStaffName",
- sys.f_get_name_i18n(tdktype.kind_name_i18n, #{i18n}) AS "outTypeName",
- sys.f_get_name_i18n(tdk.kind_name_i18n, #{i18n}) AS "outStatusName",
- tmd.data_value as out_reason_name
- from dkic_b.t_psi_outbound tpo
- <include refid="Select_Inbound_Join_Table_Out"/>
- <where>
- AND tpo.cp_id = #{cpId}
- <if test="outTypes != null and outTypes.size()>0">
- AND tpo.out_type =any(#{outTypes,typeHandler=StringListTypeHandler})
- </if>
- <if test="outTypes == null || outTypes.size()==0">
- AND (tpo.out_type = '出库类型-其他出库'
- or tpo.out_type = '出库类型-销售出库')
- </if>
- <if test="outStatus != null and outStatus != '' ">
- AND tpo.out_status LIKE concat('%',my_ex.likequery(#{outStatus}),'%')
- </if>
- <if test="makeTimeStart != null and makeTimeEnd != null">
- AND tpo.make_time >= #{makeTimeStart}::timestamp with time zone
- AND tpo.make_time < #{makeTimeEnd}::timestamp with time zone + interval '1 day'
- </if>
- <if test="outNo != null and outNo != ''">
- AND tpo.out_no LIKE concat('%',my_ex.likequery(#{outNo}),'%')
- </if>
- <if test="cusPhone != null and cusPhone != ''">
- AND tmc.cus_phone LIKE concat('%',my_ex.likequery(#{cusPhone}),'%')
- </if>
- <if test="cusName != null and cusName != ''">
- AND tmc.cus_name LIKE concat('%',my_ex.likequery(#{cusName}),'%')
- </if>
- <if test="supId != null and supId != ''">
- AND tpo.sup_id = #{supId}::uuid
- </if>
- <if test="orgIdList != null and orgIdList.size() > 0">
- AND tmo.org_id =any(#{orgIdList, typeHandler=uuidListTypeHandler})
- </if>
- <if test="staffIdList != null and staffIdList.size() > 0">
- AND tms.staff_id =any(#{staffIdList, typeHandler=uuidListTypeHandler})
- </if>
- <if test="flgValidList != null and flgValidList.size()>0">
- AND tpo.flg_valid =any(#{flgValidList, typeHandler=BooleanListTypeHandler})
- </if>
- </where>
- union all
- SELECT
- <include refid="Base_Column_List_Response_Into"/>,
- tmo.org_name AS "orgName",
- tmp.sup_name AS "supplierName",
- tms.staff_name AS "staffName",
- tms.staff_name AS "makeStaffName",
- tmc.cus_name as "cusName",
- tmc.cus_phone as "cusPhone",
- tmc.cus_from as "cusFrom",
- makestaff.staff_name as "makeStaffName",
- sys.f_get_name_i18n(tdktype.kind_name_i18n, #{i18n}) AS "outTypeName",
- sys.f_get_name_i18n(tdk.kind_name_i18n, #{i18n}) AS "outStatusName",
- tmd.data_value as out_reason_name
- FROM dkic_b.t_psi_inbound tpi
- <include refid="Select_Inbound_Join_Table_Into"/>
- <where>
- AND tpi.cp_id = #{cpId}
- <if test="outTypes != null and outTypes.size()>0">
- AND tpi.into_type =any(#{outTypes,typeHandler=StringListTypeHandler})
- </if>
- <if test="outTypes == null || outTypes.size()==0">
- AND tpi.into_type = '入库类型-采退入库'
- </if>
- <if test="intoStatus != null and intoStatus != '' ">
- AND tpi.into_status LIKE concat('%',my_ex.likequery(#{intoStatus}),'%')
- </if>
- <if test="makeTimeStart != null and makeTimeEnd != null">
- AND tpi.make_time >= #{makeTimeStart}::timestamp with time zone
- AND tpi.make_time < #{makeTimeEnd}::timestamp with time zone + interval '1 day'
- </if>
- <if test="outNo != null and outNo != ''">
- AND tpi.into_no LIKE concat('%',my_ex.likequery(#{outNo}),'%')
- </if>
- <if test="cusPhone != null and cusPhone != ''">
- AND tmc.cus_phone LIKE concat('%',my_ex.likequery(#{cusPhone}),'%')
- </if>
- <if test="cusName != null and cusName != ''">
- AND tmc.cus_name LIKE concat('%',my_ex.likequery(#{cusName}),'%')
- </if>
- <if test="supId != null and supId != ''">
- AND tpi.sup_id = #{supId}::uuid
- </if>
- <if test="orgIdList != null and orgIdList.size() > 0">
- AND tmo.org_id =any(#{orgIdList, typeHandler=uuidListTypeHandler})
- </if>
- <if test="staffIdList != null and staffIdList.size() > 0">
- AND tms.staff_id =any(#{staffIdList, typeHandler=uuidListTypeHandler})
- </if>
- <if test="flgValidList != null and flgValidList.size()>0">
- AND tpi.flg_valid =any(#{flgValidList, typeHandler=BooleanListTypeHandler})
- </if>
- </where>
- ) tt
- </select>
- <!--出库办理显示出库关联表-->
- <sql id="Select_Inbound_Join_Table_Out">
- Left join dkic_b.t_mst_org tmo on tmo.org_id = tpo.org_id
- Left join dkic_b.t_mst_supplier tmp on tmp.sup_id = tpo.sup_id
- Left join dkic_b.t_mst_staff tms on tms.staff_id = tpo.staff_id
- Left join dkic_b.t_mst_staff makestaff on makestaff.staff_id = tpo.make_staff
- LEFT JOIN sys.t_data_kind tdk ON tdk.kind_code = tpo.out_status
- LEFT JOIN sys.t_data_kind tdktype ON tdktype.kind_code = tpo.out_type
- left join dkic_b.t_mst_customer tmc on tpo.cus_id = tmc.cus_id
- left join dkic_b.t_mst_dictionary_data tmd on tmd.data_id = tpo.out_reason
- </sql>
- <!--出库办理显示入库关联表-->
- <sql id="Select_Inbound_Join_Table_Into">
- Left join dkic_b.t_mst_org tmo on tmo.org_id = tpi.org_id
- Left join dkic_b.t_mst_supplier tmp on tmp.sup_id = tpi.sup_id
- Left join dkic_b.t_mst_staff tms on tms.staff_id = tpi.staff_id
- Left join dkic_b.t_mst_staff makestaff on makestaff.staff_id = tpi.make_staff
- LEFT JOIN sys.t_data_kind tdk ON tdk.kind_code = tpi.into_status
- LEFT JOIN sys.t_data_kind tdktype ON tdktype.kind_code = tpi.into_type
- left join dkic_b.t_mst_customer tmc on tpi.cus_id = tmc.cus_id
- left join dkic_b.t_mst_dictionary_data tmd on tmd.data_id = tpi.into_reason
- </sql>
- <!-- 根据来源id查询 -->
- <select id="selectByFromId" resultMap="BaseResultMapResponse">
- SELECT
- <include refid="Base_Column_List_Response"/>
- FROM dkic_b.t_psi_outbound tpo
- WHERE tpo.from_id = #{fromId}::uuid
- and tpo.flg_valid
- </select>
- <!-- 查询总单带明细 -->
- <select id="selectByCondDetail" resultMap="BaseResultMapDetailResponse">
- SELECT t.out_id,
- t.out_no,
- t.out_type,
- t.from_id,
- t.from_no,
- t.from_no as "orderNo",
- t.org_id,
- tmo.org_name as "orgName",
- t.staff_id,
- tms.staff_name as "staffName",
- t.cus_id,
- tmc.cus_code as "cusCode",
- tmc.cus_name as "cusName",
- tmc.cus_phone as "cusPhone",
- tmc.cus_from as "cusFrom",
- tmc.contact_phone as "contactPhone",
- tmc.address_full as "addressFull",
- tmdd.data_value as cus_from_name,
- tmc.address_area,
- tmc.address_name,
- tmc.address_no,
- tmc.address_gcj02,
- tmc.address_full,
- tmc.contact_name,
- tmc.contact_phone,
- tmc.channel_id as sales_channel,
- tmsc.channel_name as channel_name,
- t.sup_id,
- t.out_status,
- sys.f_get_name_i18n(tdk1.kind_name_i18n, #{i18n}) as "outStatusName",
- t.outing_qty,
- t.outing_amt,
- t.out_qty,
- t.out_amt,
- t.return_qty,
- t.return_amt,
- t.out_date,
- t.remarks,
- t.annex_paths,
- t.make_staff,
- makestaff.staff_name as "makeStaffName",
- t.make_time,
- t.receivable_id,
- t.cp_id,
- t.flg_valid,
- tmp.sup_name AS "supplierName",
- t.out_reason,
- t.flg_auto_handle,
- t.flg_handle_setting,
- tmd.data_value as out_reason_name,
- <include refid="Base_Column_List_Item_Response_Detail_Join"/>
- FROM dkic_b.t_psi_outbound as t
- left join dkic_b.t_mst_customer tmc on tmc.cus_id = t.cus_id
- left join dkic_b.t_mst_sale_channel tmsc on tmsc.channel_id = tmc.channel_id
- left join dkic_b.t_mst_org tmo on tmo.org_id = t.org_id
- left join dkic_b.t_mst_staff tms on tms.staff_id = t.staff_id
- left join dkic_b.t_mst_staff as makestaff on makestaff.staff_id = t.make_staff
- left join dkic_b.t_mst_dictionary_data tmdd on tmdd.data_id = tmc.cus_from
- left join sys.t_data_kind as tdk1 on tdk1.kind_code = t.out_status
- left join dkic_b.t_mst_dictionary_data tmd on tmd.data_id = t.out_reason
- Left join dkic_b.t_mst_supplier tmp on tmp.sup_id = t.sup_id
- left join dkic_b.t_psi_outbound_item tpoi on tpoi.out_id = t.out_id
- inner join dkic_b.t_mst_goods_sku tmgs on tmgs.sku_id = tpoi.sku_id
- left join dkic_b.t_mst_goods_brand tmgb on tmgb.brand_id = tmgs.brand_id
- left join dkic_b.t_psi_inventory tpity on tpity.inv_id = tpoi.inv_id
- left join dkic_b.t_mst_warehouse as tmw on tpity.wh_id = tmw.wh_id
- <include refid="Condition"/>
- order by t.make_time desc
- <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
- limit #{end} offset #{start}
- </if>
- </select>
- <sql id="Base_Column_List_Item_Response_Detail_Join">
- tpoi.item_id AS "list_item_id",
- tpoi.out_id AS "list_out_id",
- t.out_no AS "list_out_no",
- tpoi.out_type AS "list_out_type",
- tpoi.from_id AS "list_from_id",
- tpoi.from_item_id AS "list_from_item_id",
- tpoi.item_index AS "list_item_index",
- tpoi.sku_id AS "list_sku_id",
- tpoi.price_out AS "list_price_out",
- tpoi.non_std_code AS "list_non_std_code",
- tpoi.out_status AS "list_out_status",
- tpoi.outing_qty AS "list_outing_qty",
- tpoi.outing_amt AS "list_outing_amt",
- tpoi.out_qty AS "list_out_qty",
- tpoi.out_amt AS "list_out_amt",
- tpoi.return_qty AS "list_return_qty",
- tpoi.return_amt AS "list_return_amt",
- tpoi.remarks AS "list_remarks",
- tpoi.inv_id AS "list_inv_id",
- tpoi.cost_price AS "list_cost_price",
- tpoi.cost_amt AS "list_cost_amt",
- tpoi.flg_valid AS "list_flg_valid",
- tpoi.cp_id AS "list_cp_id",
- tpoi.s_out_id AS "list_s_out_id",
- tpoi.s_out_item_id AS "list_s_out_item_id",
- tpoi.s_order_id AS "list_s_order_id",
- tpoi.s_order_item_id AS "list_s_order_item_id",
- tmgs.sku_code AS list_sku_code,
- tmgs.sku_model AS list_sku_model,
- tmgs.sku_name AS list_sku_name,
- tmgb.brand_name AS list_brand_name,
- tmgb.short_name AS list_short_name,
- tmgs.price_purchase AS list_price_purchase,
- tmgs.price_standard AS list_price_standard,
- tmgs.sku_images AS list_sku_images,
- tpity.wh_id AS list_wh_id,
- tmw.wh_name AS list_wh_name
- </sql>
- <select id="countByCondDetail" resultType="Long">
- SELECT
- count(1)
- FROM dkic_b.t_psi_outbound as t
- <include refid="Condition"/>
- </select>
- </mapper>
|