FengChaoYu hai 1 ano
pai
achega
54faeb2c22

+ 21 - 0
src/main/resources/mapper/AdminMapper.xml

@@ -19,6 +19,13 @@
             <if test="isJiaXian == null">
                 and a.is_jiaxian = 0
             </if>
+
+            <if test="isGongcheng != null">
+                and a.is_gongcheng = #{isGongcheng}
+            </if>
+            <if test="isGongcheng == null">
+                and a.is_gongcheng = 0
+            </if>
              <if test="isMaster != null">
                 and a.is_master = #{isMaster}
             </if>
@@ -109,5 +116,19 @@
 
     </select>
 
+    <select id="selectByUserName" resultType="com.zfire.mall.manager.plus.entity.AdminUser">
+        select
+            *
+        from admin_user
+
+        where 1=1
+        and user_name =#{userName}
+
+
+    </select>
+
+    <delete id="delByUserName" >
+      DELETE FROM admin_user WHERE user_name =#{userName};
+    </delete>
 
 </mapper>

+ 14 - 4
src/main/resources/mapper/CommonCMapper.xml

@@ -29,6 +29,7 @@
             king_dee_customer a
 			LEFT JOIN admin_user b on  a.number = b.user_name
          ${ex.query}
+         and a.jiaxian_type = 'KING'
          order by a.create_time desc
     </select>
 
@@ -150,16 +151,25 @@
             a.*,
             b.name as 'wallet_name',
             c.`name` as 'customerName',
-            d.name as 'wlCompanyName'
+            d.name as 'wlCompanyName',
+            e.service_name
           from
             king_dee_receipt a
             join king_dee_wallet b on a.wallet_id=b.id
             join king_dee_customer c on c.id = a.customer_id
             left join king_dee_customer d on d.id=a.wl_company_type
+            join customer_product_type_rela e on e.wallet_id=a.wallet_id and e.customer_id=a.customer_id
          ${ex.query}
          <if test="customerId != null and customerId != ''">
              and a.customer_id = #{customerId}
          </if>
+        <if test="serviceIds != null and serviceIds.size > 0">
+            and e.service_id in
+            <foreach item="item" index="index" collection="serviceIds" open="(" separator=","
+                     close=")">
+                #{item}
+            </foreach>
+        </if>
          order by a.create_time desc
     </select>
 
@@ -248,7 +258,7 @@
             b.material_code,
             b.material_id,
             b.specification,
-            (b.refundable_qty - b.withhold ) as refundable_qty,
+            (b.refundable_qty) as refundable_qty,
             b.price,
             b.qty+b.refund_product_qty as qty,
             b.retired_qty,
@@ -533,7 +543,7 @@
             b.material_number as 'material_code',
             b.material_id,
             b.specification,
-            (b.refundable_qty - b.withhold ) as refundable_qty,
+            (b.refundable_qty ) as refundable_qty,
             b.price,
             b.qty+b.refund_product_qty as qty,
             b.retired_qty,
@@ -622,7 +632,7 @@
           from
             king_dee_customer a
          ${ex.query}
-         and a.jiaxian_type = 'JIAXIAN'
+         and a.jiaxian_type in ('JIAXIAN','GONGCHENG')
         <if test="customerId != null and customerId != ''">
             and a.higher_prant_number = #{customerId}
         </if>

+ 27 - 0
src/main/resources/mapper/CommonMapper.xml

@@ -0,0 +1,27 @@
+<?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.zfire.mall.manager.commonmapper.CommonMapper">
+
+    <select id="merchantLoginQuotaLimitList" resultType="com.zfire.mall.manager.plus.entity.CustomerBillLimitConfig">
+        SELECT a.*, b.name AS customer_name
+        FROM customer_bill_limit_config a LEFT JOIN king_dee_customer b ON a.customer_id = b.id
+        ${ex.query}
+        AND del = 0
+        <if test="ex.orderBy == null or ex.orderBy ==''">
+            order by a.create_time desc
+        </if>
+        ${ex.orderBy}
+    </select>
+
+    <select id="firstPartyCustomerManagementList" resultType="com.zfire.mall.manager.plus.entity.PartyAInfo">
+        SELECT a.*
+        FROM party_a_info a
+        ${ex.query}
+        AND del = 0
+        <if test="ex.orderBy == null or ex.orderBy ==''">
+            order by a.create_time desc
+        </if>
+        ${ex.orderBy}
+    </select>
+
+</mapper>

+ 46 - 6
src/main/resources/mapper/CountMapper.xml

@@ -5,10 +5,14 @@
 
     <sql id="retailSql">
         select
+            b.full_cost_time,
             b.material_old_number,
             a.create_time,
             a.the_time,
             a.id,
+            b.is_cost,
+            null as ref_use_unit,
+            null as ref_project_note,
             a.customer_id,
             b.is_displace_order,
             a.customer_number as 'customer_number',
@@ -20,7 +24,7 @@
             b.material_code,
             b.material_id,
             b.specification,
-            (b.refundable_qty - b.withhold ) as refundable_qty,
+            (b.refundable_qty ) as refundable_qty,
             b.price,
             b.qty+b.refund_product_qty as qty,
             b.retired_qty,
@@ -77,7 +81,12 @@
 
     <sql id="retailSqlWhere">
         where a.examine_status ='OK'
-
+        <if test="costStartTime !=null and costStartTime !=''">
+            and b.full_cost_time between #{costStartTime} and #{costEndTime}
+        </if>
+        <if test="isCost !=null and isCost !=''">
+            and b.is_cost = #{isCost}
+        </if>
         <if test="materialOldNumber !=null and materialOldNumber !=''">
             and b.material_old_number like concat('%',#{materialOldNumber},'%')
         </if>
@@ -183,10 +192,14 @@
 
     <sql id="enginSql">
         select
+            b.full_cost_time,
             b.material_old_number,
             a.create_time,
             a.order_date 'the_time',
             a.engin_order_no 'id',
+            b.is_cost,
+            a.ref_use_unit,
+            a.ref_project_note,
             a.customer_id,
             b.is_displace_order,
             d.number as 'customer_number',
@@ -198,7 +211,7 @@
             b.material_number as 'material_code',
             b.material_id,
             b.specification,
-            (b.refundable_qty - b.withhold ) as refundable_qty,
+            (b.refundable_qty ) as refundable_qty,
             b.price,
             b.qty+b.refund_product_qty as qty,
             b.retired_qty,
@@ -256,9 +269,18 @@
 
     <sql id="enginSqlWhere">
         where a.examine_status ='OK'
+        <if test="costStartTime !=null and costStartTime !=''">
+            and b.full_cost_time between #{costStartTime} and #{costEndTime}
+        </if>
         <if test="materialOldNumber !=null and materialOldNumber !=''">
             and b.material_old_number like concat('%',#{materialOldNumber},'%')
         </if>
+        <if test="isCost !=null and isCost !=''">
+            and b.is_cost = #{isCost}
+        </if>
+        <if test="refUseUnit !=null and refUseUnit !=''">
+            and a.ref_use_unit like concat('%',#{refUseUnit},'%')
+        </if>
         <if test="id !=null and id !=''">
             and a.engin_order_no like concat('%',#{id},'%')
         </if>
@@ -371,9 +393,27 @@
     </select>
 
     <select id="queryOrderExecTotal" resultType="com.zfire.mall.manager.bean.OrderExecBean">
-        (<include refid="retailSql"></include>)
-        union
-        (<include refid="enginSql"></include>)
+        <if test=" total > 0 and total2 > 0">
+            (
+        </if>
+      <if test=" total > 0">
+        <include refid="retailSql"></include>
+      </if>
+        <if test=" total > 0 and total2 > 0">
+            )
+        </if>
+        <if test=" total > 0 and total2 > 0">
+          union
+      </if>
+        <if test=" total > 0 and total2 > 0">
+            (
+        </if>
+      <if test="total2 > 0">
+        <include refid="enginSql"></include>
+      </if>
+        <if test=" total > 0 and total2 > 0">
+            )
+        </if>
     </select>
 
 </mapper>

+ 23 - 2
src/main/resources/mapper/DepositMangeReserveMapper.xml

@@ -137,6 +137,11 @@
         <result column="in_factory_type" jdbcType="VARCHAR" property="inFactoryType" />
         <result column="sales_qty" jdbcType="INTEGER" property="salesQty" />
         <result column="sales_amount" jdbcType="DECIMAL" property="salesAmount" />
+        <result column="deposit_material_id" jdbcType="VARCHAR" property="depositMaterialId" />
+        <result column="deposit_material_number" jdbcType="VARCHAR" property="depositMaterialNumber" />
+        <result column="deposit_material_name" jdbcType="VARCHAR" property="depositMaterialName" />
+        <result column="deposit_material_old_number" jdbcType="VARCHAR" property="depositMaterialOldNumber" />
+        <result column="deposit_specification" jdbcType="VARCHAR" property="depositSpecification" />
     </resultMap>
 
     <select id="listPage" resultType="com.zfire.mall.manager.bean.engin.deposit.DepositManageBean">
@@ -396,7 +401,12 @@
         b.contract_amount,
         b.customer_wallet_id,
         b.sales_qty,
-        b.sales_amount
+        b.sales_amount,
+        b.deposit_material_id,
+        b.deposit_material_name,
+        b.deposit_material_number,
+        b.deposit_material_old_number,
+        b.deposit_specification
         FROM
         deposit_manage a JOIN deposit_manage_item b ON a.deposit_manage_id = b.parent_id
         <where>
@@ -710,7 +720,12 @@
             b.in_factory_type,
             b.customer_wallet_id,
             b.sales_qty AS itemSalesQty,
-            b.sales_amount AS itemSalesAmount
+            b.sales_amount AS itemSalesAmount,
+            b.deposit_material_id,
+            b.deposit_material_name,
+            b.deposit_material_number,
+            b.deposit_material_old_number,
+            b.deposit_specification
         FROM
             deposit_manage a
                 LEFT JOIN deposit_manage_item b ON a.deposit_manage_id = b.parent_id
@@ -753,6 +768,12 @@
             a.ref_to_retail_idea = IFNULL(b.toRetailIdea, a.ref_to_retail_idea),
             a.ref_data_delay_idea = IFNULL(b.dataDelayIdea, a.ref_data_delay_idea),
             a.ref_other_annex_idea = IFNULL(b.otherAnnexIdea, a.ref_other_annex_idea)
+            <!-- ,
+            a.ref_contract_result = IFNULL(b.contractResult, a.ref_contract_result),
+            a.ref_to_retail_result = IFNULL(b.toRetailResult, a.ref_to_retail_result),
+            a.ref_data_delay_result = IFNULL(b.dataDelayResult, a.ref_data_delay_result),
+            a.ref_other_annex_result = IFNULL(b.otherAnnexResult, a.ref_other_annex_result)
+            -->
         WHERE 1 = 1
     </update>
 </mapper>

+ 135 - 0
src/main/resources/mapper/LoginOrderMapper.xml

@@ -0,0 +1,135 @@
+<?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.zfire.mall.manager.commonmapper.trade.LoginOrderMapper">
+    <select id="workOrderList" resultType="com.zfire.mall.manager.bean.trade.WorkLoginOrderVO">
+        SELECT
+        a.*
+        FROM
+        trade_login_order a
+        ${ex.query}
+        AND a.del = 0
+        AND (
+                (a.order_type = 'WORK' AND a.is_span = 0 AND a.order_status IN ('WAIT', 'OK', 'FAIL', 'RETURN'))
+                OR
+                (a.admin_user_id = #{adminUserId} AND a.is_span = 0 AND a.order_type = 'WORK' AND a.order_status = 'SAVE')
+            )
+        <if test="ex.orderBy == null or ex.orderBy ==''">
+            ORDER BY a.create_time DESC
+        </if>
+        ${ex.orderBy}
+
+    </select>
+
+    <select id="homeOrderList" resultType="com.zfire.mall.manager.bean.trade.HomeLoginOrderVO">
+        SELECT
+        a.*
+        FROM
+        trade_login_order a
+        ${ex.query}
+        AND a.del = 0
+        AND (
+                (a.order_type = 'HOME' AND a.is_span = 0 AND a.order_status IN ('WAIT', 'OK', 'FAIL', 'RETURN'))
+                OR
+                (a.admin_user_id = #{adminUserId} AND a.order_type = 'HOME' AND a.is_span = 0 AND a.order_status = 'SAVE')
+            )
+        <if test="ex.orderBy == null or ex.orderBy ==''">
+            ORDER BY a.create_time DESC
+        </if>
+        ${ex.orderBy}
+    </select>
+
+    <select id="spanOrderList" resultType="com.zfire.mall.manager.bean.trade.SpanLoginOrderVO">
+        SELECT
+        a.*
+        FROM
+        trade_login_order a
+        ${ex.query}
+        AND a.del = 0
+        AND (
+                (a.is_span = 1 AND a.order_status IN ('WAIT', 'OK', 'FAIL', 'RETURN'))
+                OR
+                (a.admin_user_id = #{adminUserId} AND a.is_span = 1 AND a.order_status = 'SAVE')
+            )
+        <if test="ex.orderBy == null or ex.orderBy ==''">
+            ORDER BY a.create_time DESC
+        </if>
+        ${ex.orderBy}
+    </select>
+
+    <select id="queryPositionProject" resultType="com.zfire.mall.manager.bean.trade.PositionProjectBean">
+        SELECT * FROM (
+            SELECT
+            a.project_name,a.lat,a.lnt,a.project_no,a.address,
+            <!-- 按千米距离排序计算 -->
+            ROUND(
+            6378.138 * 2 * ASIN(
+            SQRT(
+            POW( SIN( ( #{lat} * PI() / 180 - lat * PI() / 180 ) / 2 ), 2 ) + COS( #{lat} * PI() / 180 ) * COS( lat * PI() / 180 ) * POW( SIN( ( #{lnt} * PI() / 180 - lnt * PI() / 180 ) / 2 ), 2 )
+            )
+            )
+            , 2) AS distance
+
+            FROM trade_login_order a
+            WHERE
+                a.id <![CDATA[ <> ]]> #{id}
+                AND a.status = 'ING'
+                AND a.login_status = 'OK'
+                AND a.del = 0
+            ORDER BY distance,a.id
+        ) a WHERE a.distance <![CDATA[ < ]]> #{val}
+    </select>
+    <select id="orderCount" resultType="com.zfire.mall.manager.bean.trade.OrderTypeCountBean">
+        SELECT IFNULL(SUM(IF(order_type = 'WORK' AND is_span = 0, 1, 0)), 0) AS work_count,
+               IFNULL(SUM(IF(order_type = 'HOME' AND is_span = 0, 1, 0)), 0)  AS home_count,
+               IFNULL(SUM(IF(is_span = 1, 1, 0)), 0)                          AS span_count
+        FROM trade_login_order
+        WHERE customer_id = #{customerId}
+          AND `status` = 'ING'
+          AND order_status IN ('WAIT', 'OK')
+          AND del = 0
+    </select>
+    <select id="dataListPage" resultType="com.zfire.mall.manager.bean.trade.DataLoginOrderVO">
+        SELECT
+            customer_name,
+            SUM(IF( order_type = 'HOME' AND is_span = 0 AND order_status IN ('WAIT','OK','FAIL','RETURN'), 1, 0 )) AS home_count,
+            SUM(IF( order_type = 'HOME' AND is_span = 0 AND order_status = 'OK', 1, 0 )) AS home_success_count,
+            SUM(IF( order_type = 'HOME' AND is_span = 0 AND order_status = 'OK' AND `status` = 'SIGN', 1, 0 )) AS home_sign_count,
+            SUM(IF( order_type = 'HOME' AND is_span = 0 AND order_status = 'OK' AND `status` = 'LOSS', 1, 0 )) AS home_loss_count,
+            SUM(IF( order_type = 'WORK' AND is_span = 0 AND order_status IN ('WAIT','OK','FAIL','RETURN'), 1, 0 )) AS work_count,
+            SUM(IF( order_type = 'WORK' AND is_span = 0 AND order_status = 'OK', 1, 0 )) AS work_success_count,
+            SUM(IF( order_type = 'WORK' AND is_span = 0 AND order_status = 'OK' AND `status` = 'SIGN', 1, 0 )) AS work_sign_count,
+            SUM(IF( order_type = 'WORK' AND is_span = 0 AND order_status = 'OK' AND `status` = 'LOSS', 1, 0 )) AS work_loss_count,
+            SUM(IF( is_span = 1 AND order_status IN ('WAIT','OK','FAIL','RETURN'), 1, 0 )) AS span_count,
+            SUM(IF( is_span = 1 AND order_status = 'OK', 1, 0 )) AS span_success_count,
+            SUM(IF( is_span = 1 AND order_status = 'OK' AND `status` = 'SIGN', 1, 0 )) AS span_sign_count,
+            SUM(IF( is_span = 1 AND order_status = 'OK' AND `status` = 'LOSS', 1, 0 )) AS span_loss_count
+        FROM
+        trade_login_order
+        ${ex.query}
+        AND del = 0
+        GROUP BY customer_id
+        ${ex.orderBy}
+    </select>
+    <select id="list" resultType="com.zfire.mall.manager.bean.trade.LoginOrderVO">
+        SELECT
+        a.*
+        FROM
+        trade_login_order a
+        ${ex.query}
+        AND a.order_status IN ('WAIT','OK','FAIL','RETURN')
+        AND a.del = 0
+        <if test="ex.orderBy == null or ex.orderBy ==''">
+            ORDER BY a.create_time DESC
+        </if>
+        ${ex.orderBy}
+    </select>
+
+    <select id="syncLoginOrderRefCustomerId" resultType="com.zfire.mall.manager.plus.entity.TradeLoginOrder">
+        SELECT *
+        FROM trade_login_order
+        WHERE project_no = #{projectNo}
+            AND is_span = #{isSpan}
+            AND del = 0
+        FOR UPDATE
+    </select>
+</mapper>

+ 4 - 2
src/main/resources/mapper/SaleOrderMapper.xml

@@ -1006,7 +1006,8 @@ where so.id = #{id}
         ia.order_time as invoiceOrderTime,
         pms.`status`,
         pms.print_time,
-        cptr.k3_org_number
+        cptr.k3_org_number,
+        so.logistics_name
         FROM
         sales_order so
         JOIN sales_order_item iao ON so.id = iao.sales_order_no
@@ -1189,7 +1190,8 @@ where so.id = #{id}
         ia.order_time as invoiceOrderTime,
         pms.`status`,
         pms.print_time,
-        cptr.k3_org_number
+        cptr.k3_org_number,
+        so.logistics_name
         FROM
         sales_order so
         JOIN sales_order_item iao ON so.id = iao.sales_order_no

+ 272 - 0
src/main/resources/mapper/StockCostMapper.xml

@@ -0,0 +1,272 @@
+<?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.zfire.mall.manager.commonmapper.StockCostMapper">
+
+
+	<select id="listFullData" resultType="com.zfire.mall.manager.bean.stock.OrderFullDateVO">
+		SELECT
+		a.order_full_data_id,
+		a.year_time,
+		a.month_time,
+		a.order_type,
+		a.order_no,
+		a.order_time,
+		a.examine_time,
+		a.customer_number,
+		a.customer_id,
+		a.customer_name,
+		a.ref_use_unit,
+		a.material_id,
+		a.material_old_number,
+		a.material_code,
+		a.material_name,
+		a.specification,
+		a.order_num,
+		a.pay_amount,
+		a.customer_wallet_id,
+		a.customer_wallet_name,
+		a.customer_wallet_number,
+
+
+		DATE_FORMAT(a.full_start_time, '%Y-%m-%d') as full_start_time,
+		DATE_FORMAT(a.full_end_time, '%Y-%m-%d') as full_end_time,
+
+		a.full_num,
+		a.full_cost,
+		a.create_by,
+		a.create_time,
+		a.update_by,
+		a.update_time,
+
+		a.k3_category_id,
+		a.k3_category_number,
+		a.k3_category_name
+		FROM
+		order_full_date a
+		join customer_product_type_rela cptr on a.customer_wallet_id = cptr.customer_wallet_id
+		${ex.query}
+		<if test="customerId != null and customerId != ''">
+			and a.customer_id = #{customerId}
+		</if>
+
+		<if test="serviceIds != null and serviceIds.size > 0">
+			and cptr.service_id in
+			<foreach item="item" index="index" collection="serviceIds" open="(" separator=","
+					 close=")">
+				#{item}
+			</foreach>
+		</if>
+
+		<if test="k3CategoryIds != null and k3CategoryIds.size > 0">
+			and a.k3_category_id in
+			<foreach item="item" index="index" collection="k3CategoryIds" open="(" separator=","
+					 close=")">
+				#{item}
+			</foreach>
+		</if>
+
+		<if test="ex.orderBy == null or ex.orderBy ==''">
+			order by a.create_time desc
+		</if>
+
+		${ex.orderBy}
+	</select>
+
+    <select id="list" resultType="com.zfire.mall.manager.bean.stock.OrderFullCostVO">
+		SELECT
+		s.*
+		FROM
+		(
+        SELECT
+        	b.material_name,
+        	b.material_code,
+        	b.retail_order_id AS orderId,
+        	b.material_old_number,
+        	b.material_id,
+        	b.specification,
+        	b.full_num,
+			DATE_FORMAT(b.full_time, '%Y-%m-%d') as full_time,
+        	IF
+        	( b.full_num > 5, 'YES', 'NO' ) AS full
+        FROM
+        	retail_order_item b
+        	JOIN retail_order a ON a.id = b.retail_order_id
+        WHERE
+        	b.full_status = 'YES'
+        and	b.refundable_qty > 0
+		<if test="materialName != null and materialName != ''">
+			and b.material_name = #{materialName}
+		</if>
+		<if test="orderId != null and orderId != ''">
+			and a.id = #{orderId}
+		</if>
+		<if test="materialNumber != null and materialNumber != ''">
+			and b.materialNumber = #{materialNumber}
+		</if>
+		<if test="specification != null and specification != ''">
+			and b.specification = #{specification}
+		</if>
+		<if test="startTime != null and startTime != ''">
+			and b.full_time BETWEEN  #{startTime} and #{endTime}
+		</if>
+		<if test="materialOldNumber != null and materialOldNumber != ''">
+			and b.material_old_number = #{materialOldNumber}
+		</if>
+		<if test="customerId != null and customerId != ''">
+			and a.customer_id = #{customerId}
+		</if>
+        UNION
+        SELECT
+        	b.material_name,
+        	b.material_number AS material_code,
+        	b.engin_order_no AS orderId,
+        	b.material_old_number,
+        	b.material_id,
+        	b.specification,
+        	b.full_num,
+			DATE_FORMAT(b.full_time, '%Y-%m-%d') as full_time,
+		IF
+        	( b.full_num > 5, 'YES', 'NO' ) AS FULL
+        FROM
+        	engin_order_item b
+        	JOIN engin_order a ON b.engin_order_no = a.engin_order_no
+        WHERE
+        	b.full_status = 'YES'
+		and b.refundable_qty > 0
+		<if test="materialName != null and materialName != ''">
+			and b.material_name = #{materialName}
+		</if>
+		<if test="orderId != null and orderId != ''">
+			and a.engin_order_no = #{orderId}
+		</if>
+		<if test="materialNumber != null and materialNumber != ''">
+			and b.materialNumber = #{materialNumber}
+		</if>
+		<if test="specification != null and specification != ''">
+			and b.specification = #{specification}
+		</if>
+		<if test="startTime != null and startTime != ''">
+			and b.full_time BETWEEN  #{startTime} and #{endTime}
+		</if>
+		<if test="materialOldNumber != null and materialOldNumber != ''">
+			and b.material_old_number = #{materialOldNumber}
+		</if>
+		<if test="customerId != null and customerId != ''">
+			and a.customer_id = #{customerId}
+		</if>
+		) s
+		ORDER BY
+		s.full_num DESC
+    </select>
+	<select id="listFullCost" resultType="com.zfire.mall.manager.bean.stock.OrderFullCostDayVO">
+		SELECT
+		a.order_full_cost_id,
+		a.year_time,
+		a.month_time,
+		a.status,
+		a.order_type,
+		a.order_no,
+		a.order_time,
+		a.examine_time,
+		a.customer_number,
+		a.customer_id,
+		a.customer_name,
+		a.ref_use_unit,
+		a.material_id,
+		a.material_old_number,
+		a.material_code,
+		a.material_name,
+		a.specification,
+		a.order_num,
+		a.pay_amount,
+		a.customer_wallet_id,
+		a.customer_wallet_name,
+		a.customer_wallet_number,
+		a.overdue_num,
+
+
+		DATE_FORMAT(a.full_start_time, '%Y-%m-%d') as full_start_time,
+		DATE_FORMAT(a.full_end_time, '%Y-%m-%d') as full_end_time,
+
+		a.full_num,
+		a.full_cost,
+		a.create_by,
+		a.create_time,
+		a.update_by,
+		a.update_time,
+		a.note,
+		a.k3_category_id,
+		a.k3_category_number,
+		a.k3_category_name
+		FROM
+		order_full_cost a
+		join customer_product_type_rela cptr on a.customer_wallet_id = cptr.customer_wallet_id
+		${ex.query}
+		<if test="customerId != null and customerId != ''">
+			and a.customer_id = #{customerId}
+		</if>
+
+		<if test="serviceIds != null and serviceIds.size > 0">
+			and cptr.service_id in
+			<foreach item="item" index="index" collection="serviceIds" open="(" separator=","
+					 close=")">
+				#{item}
+			</foreach>
+		</if>
+
+		<if test="k3CategoryIds != null and k3CategoryIds.size > 0">
+			and a.k3_category_id in
+			<foreach item="item" index="index" collection="k3CategoryIds" open="(" separator=","
+					 close=")">
+				#{item}
+			</foreach>
+		</if>
+
+
+		<if test="ex.orderBy == null or ex.orderBy ==''">
+			order by a.create_time desc
+		</if>
+
+		${ex.orderBy}
+	</select>
+    <select id="listMonthFullCost" resultType="com.zfire.mall.manager.bean.stock.OrderFullCostMonthVO">
+		SELECT
+			ofc.year_time,
+			ofc.month_time,
+			ofc.customer_number,
+			ofc.customer_id,
+			ofc.customer_name
+		FROM
+			order_full_cost ofc
+		join customer_product_type_rela cptr on ofc.customer_wallet_id = cptr.customer_wallet_id
+		${ex.query}
+		<if test="customerId != null and customerId != ''">
+			and ofc.customer_id = #{customerId}
+		</if>
+		<if test="serviceIds != null and serviceIds.size > 0">
+			and cptr.service_id in
+			<foreach item="item" index="index" collection="serviceIds" open="(" separator=","
+					 close=")">
+				#{item}
+			</foreach>
+		</if>
+
+		<if test="k3CategoryIds != null and k3CategoryIds.size > 0">
+			and ofc.k3_category_id in
+			<foreach item="item" index="index" collection="k3CategoryIds" open="(" separator=","
+					 close=")">
+				#{item}
+			</foreach>
+		</if>
+
+		GROUP BY
+			ofc.year_time,
+			ofc.month_time,
+			ofc.customer_id
+
+		<if test="ex.orderBy == null or ex.orderBy ==''">
+			order by ofc.year_time,ofc.month_time desc
+		</if>
+		${ex.orderBy}
+	</select>
+</mapper>

+ 33 - 1
src/main/resources/mapper/StockMapper.xml

@@ -196,7 +196,9 @@
         reserved_order_item roi
         where roi.material_id = #{materialId}
         and roi.`status` = 1
-        and (roi.order_id != #{orderId} or roi.order_id is null)
+        <if test="orderId != null and orderId != ''">
+            and (roi.order_id != #{orderId} or roi.order_id is null)
+        </if>
         and (roi.customer_id != #{customerId})
         <if test="correspondId == null">
             and roi.correspond_id = null
@@ -213,7 +215,9 @@
         reserved_order_item roi
         where roi.material_id = #{materialId}
         and roi.`status` = 1
+        <if test="orderId != null and orderId != ''">
         and (roi.order_id != #{orderId} and roi.order_id is not null)
+        </if>
         and (roi.customer_id = #{customerId})
         <if test="correspondId == null">
             and roi.correspond_id = null
@@ -230,7 +234,9 @@
         reserved_order_item roi
         where roi.material_id = #{materialId}
         and roi.`status` = 1
+        <if test="orderId != null and orderId != ''">
         and (roi.order_id = #{orderId})
+        </if>
         and (roi.customer_id = #{customerId})
         <if test="correspondId == null">
             and roi.correspond_id = null
@@ -847,4 +853,30 @@
 
         ${ex.orderBy}
     </select>
+    <select id="listOne" resultType="com.zfire.mall.manager.bean.stock.StockBean">
+        SELECT
+        kdm.id as materialId,
+        kdm.number AS materialNumber,
+        kdm.`name` AS materialName,
+        kdm.old_number AS materialOldNumber,
+        kdm.specification,
+        kdm.base_unit_id,
+        kdm.category_name,
+        kdm.material_group_name
+        FROM
+        stock s
+        JOIN stock_correspond_position scp on scp.stock_id = s.stock_id
+        JOIN king_dee_material kdm ON s.material_id = kdm.id
+        JOIN stock_correspond sc on scp.correspond_id = sc.id
+        and scp.stock_id = s.stock_id
+        <if test="correspondId != null and correspondId.size > 0">
+            AND scp.correspond_id in
+            <foreach item="item" index="index" collection="correspondId" open="(" separator=","
+                     close=")">
+                #{item}
+            </foreach>
+        </if>
+         and kdm.id = #{materialId}
+        group by kdm.id
+    </select>
 </mapper>

+ 27 - 1
src/main/resources/mapper/invoiceMapper.xml

@@ -1628,6 +1628,7 @@ set a.engin_record_no  = b.ref_engin_record_no where a.bill_no = #{enginOrderNo}
         <result column="orderNotes" jdbcType="VARCHAR" property="orderNotes"/>
         <result column="refProjectCategory" jdbcType="VARCHAR" property="refProjectCategory"/>
         <result column="customerOrderId" jdbcType="VARCHAR" property="customerOrderId"/>
+        <result column="sales_order_no" jdbcType="VARCHAR" property="salesOrderNo"/>
         <collection property="goods" ofType="com.zfire.mall.manager.bean.pick.PickManagerPushGoodsBean" select="goods" column="saleCode">
             <id column="id" jdbcType="VARCHAR" property="machineSetCode"/>
             <result column="specification" jdbcType="VARCHAR" property="specification"/>
@@ -1664,7 +1665,8 @@ set a.engin_record_no  = b.ref_engin_record_no where a.bill_no = #{enginOrderNo}
         pmp.customer_order_id as customerOrderId,
         ia.remark as orderNotes,
         pmp.is_up,
-        pmp.is_discharge
+        pmp.is_discharge,
+        pmp.sales_order_no
         FROM
         pick_manager_push pmp
         join invoice_application ia on pmp.invoice_id = ia.id
@@ -2395,4 +2397,28 @@ set a.engin_record_no  = b.ref_engin_record_no where a.bill_no = #{enginOrderNo}
         ) s
 
     </select>
+
+
+    <select id="detection" resultType="String">
+    SELECT
+	roi.id
+FROM
+	retail_order_item roi
+WHERE
+	roi.withhold > 0
+	AND (
+	SELECT
+	IF
+		(
+			sum( iao.refundable_qty ) IS NULL,
+			0,
+		SUM( iao.refundable_qty ))
+	FROM
+		invoice_application_order iao
+	WHERE
+		roi.id = iao.order_id
+		AND iao.invoice_examine_status IN ( 'WAIT', 'SAVE' )
+	AND iao.refundable_qty > 0
+	) != roi.withhold
+    </select>
 </mapper>