修改 出库失败报错

master
wanghao 4 months ago
parent a7d899583f
commit 6703d73c7c

@ -88,12 +88,24 @@ public class ApiController {
@PostMapping("/outStore/submit") @PostMapping("/outStore/submit")
public AjaxResult outStoreSubmit(@RequestBody OutStoreDto outStoreDto) { public AjaxResult outStoreSubmit(@RequestBody OutStoreDto outStoreDto) {
try { try {
List<String> epcList = outStoreDto.getEpcList(); List<String> epcList = outStoreDto.getEpcList();
int size = epcList.size(); //int i=0;
for (String epc:epcList ) {
String tag = apiService.selectLedgerbyEpcForOutStore(epc);
if (tag!=null){
apiService.submitInsertRecordOut(outStoreDto,epc);
apiService.updataLedgerFoyOut(outStoreDto,epc);
//i++;
}
}
/* int size = epcList.size();
Iterator<String> iterator = epcList.iterator(); Iterator<String> iterator = epcList.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
String epc = iterator.next(); String epc = iterator.next();
String tag = apiService.selectLedgerbyEpcForOutStore(epc);
if (tag != null) { if (tag != null) {
iterator.remove(); iterator.remove();
} }
@ -103,9 +115,9 @@ public class ApiController {
if (i>0){ if (i>0){
apiService.submitInsertRecordOut(outStoreDto); apiService.submitInsertRecordOut(outStoreDto);
apiService.updataLedger(outStoreDto); apiService.updataLedger(outStoreDto);
} }*/
return success("本次入库成功:" + size1 +"条,屏蔽重复入库:"+ i +"条"); return success();
}catch (Exception e){ }catch (Exception e){
return error(); return error();
} }

@ -19,7 +19,7 @@ public interface ApiMapper {
int submintInsertLedger(@Param("inStore") InStoreDto inStore); int submintInsertLedger(@Param("inStore") InStoreDto inStore);
int submitInsertRecordOut(@Param("outStoreDto") OutStoreDto outStoreDto); int submitInsertRecordOut(@Param("outStoreDto") OutStoreDto outStoreDto,@Param("epc") String epc);
int updataLedger(@Param("outStoreDto") OutStoreDto outStoreDto); int updataLedger(@Param("outStoreDto") OutStoreDto outStoreDto);
@ -51,4 +51,6 @@ public interface ApiMapper {
String selectLedgerbyEpcForInStore(String epc); String selectLedgerbyEpcForInStore(String epc);
String selectLedgerbyEpcForOutStore(String epc); String selectLedgerbyEpcForOutStore(String epc);
int updataLedgerFoyOut(@Param("outStoreDto") OutStoreDto outStoreDto, @Param("epc") String epc);
} }

@ -28,8 +28,8 @@ public class ApiService {
return mapper.submintInsertLedger(inStore); return mapper.submintInsertLedger(inStore);
} }
public int submitInsertRecordOut(OutStoreDto outStoreDto) { public int submitInsertRecordOut(OutStoreDto outStoreDto,String epc) {
return mapper.submitInsertRecordOut(outStoreDto); return mapper.submitInsertRecordOut(outStoreDto,epc);
} }
public int updataLedger(OutStoreDto outStoreDto) { public int updataLedger(OutStoreDto outStoreDto) {
@ -91,4 +91,8 @@ public class ApiService {
public String selectLedgerbyEpcForOutStore(String epc) { public String selectLedgerbyEpcForOutStore(String epc) {
return mapper.selectLedgerbyEpcForOutStore(epc); return mapper.selectLedgerbyEpcForOutStore(epc);
} }
public int updataLedgerFoyOut(OutStoreDto outStoreDto,String epc) {
return mapper.updataLedgerFoyOut(outStoreDto,epc);
}
} }

@ -14,7 +14,7 @@
select rifd_code from ledger_rfid where rifd_code = #{epc} limit 1 select rifd_code from ledger_rfid where rifd_code = #{epc} limit 1
</select> </select>
<insert id="submintInsertRecordIn"> <insert id="submintInsertRecordIn">
INSERT ignore into bg_wheel_chocks.record_in (epc_code, batch_code, location_code,manufacturer_id, INSERT ignore into record_in (epc_code, batch_code, location_code,manufacturer_id,
manufacturer_Name, manufacturer_Name,
create_by,create_time) create_by,create_time)
VALUES VALUES
@ -26,7 +26,7 @@
<insert id="submintInsertLedger"> <insert id="submintInsertLedger">
INSERT ignore into bg_wheel_chocks.ledger_rfid (manufacturer_id, rifd_code, batch_code, location_code) INSERT ignore into ledger_rfid (manufacturer_id, rifd_code, batch_code, location_code)
VALUES VALUES
<foreach collection="inStore.epclist" item="item" separator=","> <foreach collection="inStore.epclist" item="item" separator=",">
(#{inStore.manufacturerId},#{item},#{inStore.binchCode},#{inStore.selectLocationText}) (#{inStore.manufacturerId},#{item},#{inStore.binchCode},#{inStore.selectLocationText})
@ -36,14 +36,17 @@
<!-- --> <!-- -->
<insert id="submitInsertRecordOut"> <insert id="submitInsertRecordOut">
INSERT INTO bg_wheel_chocks.record_out (epc_code, location_code, use_user, create_by) VALUES INSERT INTO record_out (epc_code, location_code, use_user, create_by)
VALUES
<foreach collection="outStoreDto.epcList" item="epc" separator=","> <foreach collection="outStoreDto.epcList" item="epc" separator=",">
(#{epc}, #{outStoreDto.areaCode}, #{outStoreDto.useUser}, #{outStoreDto.submitUser}) (
#{epc}, #{outStoreDto.areaCode}, #{outStoreDto.useUser}, #{outStoreDto.submitUser}
)
</foreach> </foreach>
</insert> </insert>
<update id="updataLedger"> <update id="updataLedger">
UPDATE bg_wheel_chocks.ledger_rfid UPDATE ledger_rfid
SET SET
location_type = '2', location_type = '2',
location_code = #{outStoreDto.areaCode}, location_code = #{outStoreDto.areaCode},
@ -53,6 +56,14 @@
#{epc} #{epc}
</foreach> </foreach>
</update> </update>
<update id="updataLedgerFoyOut">
UPDATE ledger_rfid
SET
location_type = '2',
location_code = #{outStoreDto.areaCode},
update_time = now()
WHERE rifd_code =#{epc}
</update>
<select id="storeCheckSelect" resultType="com.ruoyi.api.domain.StockDto"> <select id="storeCheckSelect" resultType="com.ruoyi.api.domain.StockDto">
select row_number() over (order by location_code) as 'index', select row_number() over (order by location_code) as 'index',
@ -65,7 +76,7 @@
</select> </select>
<insert id="insertCheckInfo"> <insert id="insertCheckInfo">
INSERT INTO bg_wheel_chocks.record_store_check_info (check_id, epc_code, location_code, check_state) INSERT INTO record_store_check_info (check_id, epc_code, location_code, check_state)
VALUES VALUES
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
(#{id}, #{item.epcCode},#{item.locationCode},#{item.state}) (#{id}, #{item.epcCode},#{item.locationCode},#{item.state})
@ -98,7 +109,7 @@
where rifd_code = #{epc} where rifd_code = #{epc}
</select> </select>
<update id="updataLedgerForBf"> <update id="updataLedgerForBf">
UPDATE bg_wheel_chocks.ledger_rfid UPDATE ledger_rfid
SET is_scrap = #{state}, SET is_scrap = #{state},
update_time=now() update_time=now()
WHERE rifd_code = #{epc} WHERE rifd_code = #{epc}
@ -114,7 +125,7 @@
from ledger_rfid lf from ledger_rfid lf
left join sys_dict_data sdd on sdd.dict_value = is_scrap and sdd.dict_type = 'bf_y_n' left join sys_dict_data sdd on sdd.dict_value = is_scrap and sdd.dict_type = 'bf_y_n'
left join sys_dict_data sdd1 on sdd1.dict_value = location_type and sdd1.dict_type = 'store_tag' left join sys_dict_data sdd1 on sdd1.dict_value = location_type and sdd1.dict_type = 'store_tag'
left join bg_wheel_chocks.record_invalidated ri on lf.rifd_code = ri.epc left join record_invalidated ri on lf.rifd_code = ri.epc
where rifd_code = #{epc} where rifd_code = #{epc}
limit 1 limit 1
</select> </select>
@ -153,14 +164,14 @@
</select> </select>
<insert id="insertWasreOutRecord"> <insert id="insertWasreOutRecord">
INSERT INTO bg_wheel_chocks.record_waste_out (epc_code, location_code, create_by) VALUES INSERT INTO record_waste_out (epc_code, location_code, create_by) VALUES
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
( #{item.epcCode},#{item.locationCode},#{user}) ( #{item.epcCode},#{item.locationCode},#{user})
</foreach> </foreach>
</insert> </insert>
<update id="updataLedgerForWasreOut" > <update id="updataLedgerForWasreOut" >
UPDATE bg_wheel_chocks.ledger_rfid UPDATE ledger_rfid
SET location_type = null, SET location_type = null,
location_code = null, location_code = null,
is_scrap = '3', is_scrap = '3',

Loading…
Cancel
Save