标准箱新购入库接口开发
This commit is contained in:
parent
49aca3a2bb
commit
a3836fdb8d
|
|
@ -19,6 +19,8 @@ public enum QrBoxStatusEnum {
|
|||
QR_BOX_STATUS_ON_RECEIVE(4, "已接收"),
|
||||
QR_BOX_STATUS_REJECT(5, "移交被驳回");
|
||||
|
||||
|
||||
|
||||
private final Integer status;
|
||||
private final String statusName;
|
||||
|
||||
|
|
|
|||
|
|
@ -162,6 +162,21 @@ public class BmQrBoxController extends BaseController {
|
|||
return qrBoxService.appWarehouse(boxBindWarehouseDto);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* APP -- 新购入库 -- 确认入库标准箱
|
||||
*/
|
||||
@ApiOperation(value = "APP -- 新购入库 -- 标准箱直接扫描入库")
|
||||
@PreventRepeatSubmit
|
||||
//@RequiresPermissions("basic:qrBox:edit")
|
||||
@SysLog(title = "APP-二维码标准箱入库", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->APP扫码创建标准箱")
|
||||
@PostMapping("/app_box_input")
|
||||
public AjaxResult appBoxInput(@RequestBody @NotNull(message = "参数不能为空") BoxBindWarehouseDto boxBindWarehouseDto) {
|
||||
return qrBoxService.appBoxInput(boxBindWarehouseDto);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* APP -- 扫码绑定机具
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.bonus.material.basic.mapper;
|
|||
|
||||
import com.bonus.common.biz.domain.lease.LeaseOutDetails;
|
||||
import com.bonus.material.basic.domain.BmQrBoxInfo;
|
||||
import com.bonus.material.basic.domain.dto.BoxBindWarehouseDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -134,4 +135,21 @@ public interface BmQrBoxMapper {
|
|||
* @return
|
||||
*/
|
||||
List<BmQrBoxInfo> selectByMaId(Long maId);
|
||||
|
||||
List<BoxBindWarehouseDto> getBoxList(BoxBindWarehouseDto boxBindWarehouseDto);
|
||||
|
||||
int updateNewInputNum(BoxBindWarehouseDto boxMa);
|
||||
|
||||
|
||||
BoxBindWarehouseDto getSingleInfo(BoxBindWarehouseDto boxMa);
|
||||
|
||||
void updatePurchaseStatus(BoxBindWarehouseDto boxMa);
|
||||
|
||||
BoxBindWarehouseDto getTaskInfo(BoxBindWarehouseDto boxMa);
|
||||
|
||||
void updateTaskStatus(BoxBindWarehouseDto boxMa);
|
||||
|
||||
int updateStorageNum(BoxBindWarehouseDto boxMa);
|
||||
|
||||
int updateBoxStatus(BoxBindWarehouseDto boxMa);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,4 +110,6 @@ public interface BmQrBoxService {
|
|||
* @return
|
||||
*/
|
||||
AjaxResult getBoxCodeList(BmQrBoxInfo bmQrBoxInfo);
|
||||
|
||||
AjaxResult appBoxInput(BoxBindWarehouseDto boxBindWarehouseDto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -560,4 +560,79 @@ public class BmQrBoxServiceImpl implements BmQrBoxService {
|
|||
}
|
||||
return AjaxResult.success(bmQrBoxMapper.getBoxCodeList(bmQrBoxInfo));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult appBoxInput(BoxBindWarehouseDto boxBindWarehouseDto) {
|
||||
int result = 0;
|
||||
try {
|
||||
List<BoxBindWarehouseDto> boxList = bmQrBoxMapper.getBoxList(boxBindWarehouseDto);
|
||||
for (BoxBindWarehouseDto boxMa: boxList) {
|
||||
//1.验证标准箱里的机具是否待入库
|
||||
if (!MaMachineStatusEnum.NEW_PURCHASE.equals(boxMa.getMaStatus())) {
|
||||
return AjaxResult.error(String.format("标准箱里%s状态异常,请检查后重新提交!", boxMa.getMaStatus()));
|
||||
}
|
||||
//2.修改新购入库数量, //2.5.修改入库任务状态
|
||||
result = updateNewInputNum(boxMa);
|
||||
if (0 == result) {
|
||||
return AjaxResult.error("入库失败:成功入库0条");
|
||||
}
|
||||
//3.修改库存
|
||||
result = updateStorageNum(boxMa);
|
||||
if (0 == result) {
|
||||
return AjaxResult.error("入库失败:成功入库0条");
|
||||
}
|
||||
//4.修改标准箱状态
|
||||
result = updateBoxStatus(boxMa);
|
||||
if (0 == result) {
|
||||
return AjaxResult.error("入库失败:成功入库0条");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
} catch (final Exception e) {
|
||||
System.err.println("入库失败,SQL执行异常:" + e.getMessage());
|
||||
return AjaxResult.error("入库失败,SQL执行异常:" + e.getMessage());
|
||||
}
|
||||
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
private int updateBoxStatus(BoxBindWarehouseDto boxMa) {
|
||||
int result = 0;
|
||||
result = bmQrBoxMapper.updateBoxStatus(boxMa);
|
||||
return result;
|
||||
}
|
||||
|
||||
private int updateStorageNum(BoxBindWarehouseDto boxMa) {
|
||||
|
||||
int result = 0;
|
||||
result = bmQrBoxMapper.updateStorageNum(boxMa);
|
||||
return result;
|
||||
}
|
||||
|
||||
private int updateNewInputNum(BoxBindWarehouseDto boxMa) {
|
||||
int result = 0;
|
||||
result = bmQrBoxMapper.updateNewInputNum(boxMa);
|
||||
|
||||
BoxBindWarehouseDto sonStatus = bmQrBoxMapper.getSingleInfo(boxMa);
|
||||
if (sonStatus != null) {
|
||||
//不用修改任务状态
|
||||
} else {
|
||||
//修改子任务状态
|
||||
bmQrBoxMapper.updatePurchaseStatus(boxMa);
|
||||
BoxBindWarehouseDto taskStatus = bmQrBoxMapper.getTaskInfo(boxMa);
|
||||
if (taskStatus != null) {
|
||||
//不用修改任务状态
|
||||
} else {
|
||||
//修改任务状态
|
||||
bmQrBoxMapper.updateTaskStatus(boxMa);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.material.purchase.mapper;
|
||||
|
||||
import com.bonus.material.basic.domain.dto.BoxBindWarehouseDto;
|
||||
import com.bonus.material.purchase.domain.PurchaseCheckDetails;
|
||||
import com.bonus.common.biz.domain.purchase.PurchaseDto;
|
||||
import com.bonus.material.purchase.domain.vo.PurchaseVo;
|
||||
|
|
@ -133,4 +134,5 @@ public interface PurchaseBindMapper {
|
|||
* @return
|
||||
*/
|
||||
List<PurchaseCheckDetails> getMachineByCode(PurchaseDto dto);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -322,4 +322,76 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where
|
||||
qb.ma_id = #{maId}
|
||||
</select>
|
||||
|
||||
<select id="getBoxList" resultType="com.bonus.material.basic.domain.dto.BoxBindWarehouseDto">
|
||||
SELECT
|
||||
qb.id AS id,
|
||||
qb.box_id AS boxId,
|
||||
qb.create_by AS createBy,
|
||||
mt1.type_name AS typeName,
|
||||
mt.type_name AS typeModelName,
|
||||
mm.ma_id AS maId,
|
||||
mm.ma_code AS maCode,
|
||||
mm.ma_status AS maStatus,
|
||||
mm.type_id AS maTypeId,
|
||||
mm.buy_task AS taskId
|
||||
FROM
|
||||
bm_qrcode_box_bind qb
|
||||
LEFT JOIN bm_qrcode_box bb on qb.box_id = bb.box_id
|
||||
LEFT JOIN ma_machine mm ON qb.ma_id = mm.ma_id
|
||||
LEFT JOIN ma_type mt ON mm.type_id = mt.type_id
|
||||
AND mt.del_flag = '0'
|
||||
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
||||
AND mt1.del_flag = '0'
|
||||
WHERE
|
||||
bb.box_code =#{boxCode}
|
||||
</select>
|
||||
|
||||
<update id="updateNewInputNum">
|
||||
update purchase_check_details set input_num = ifnull(input_num) + 1 where task_id = #{taskId} and type_id = #{maTypeId}
|
||||
</update>
|
||||
|
||||
|
||||
|
||||
<select id="getSingleInfo" resultType="com.bonus.material.basic.domain.dto.BoxBindWarehouseDto">
|
||||
SELECT
|
||||
pcd.task_id as taskId,
|
||||
pcd.type_id as typeId,
|
||||
pcd.purchase_num as purchaseNum,
|
||||
IFNULL(pcd.input_num,0) as inpuNum ,
|
||||
pcd.purchase_num - IFNULL(pcd.input_num,0) as waitNum
|
||||
FROM
|
||||
purchase_check_details pcd
|
||||
WHERE pcd.task_id = #{taskId} and pcd.type_id = #{maTypeId}
|
||||
HAVING waitNum > 0
|
||||
</select>
|
||||
|
||||
<update id="updatePurchaseStatus">
|
||||
update purchase_check_details set status =19 where task_id = #{taskId} and type_id = #{maTypeId}
|
||||
</update>
|
||||
|
||||
<select id="getTaskInfo" resultType="com.bonus.material.basic.domain.dto.BoxBindWarehouseDto">
|
||||
SELECT
|
||||
pcd.task_id as taskId,
|
||||
pcd.type_id as typeId,
|
||||
pcd.purchase_num as purchaseNum,
|
||||
IFNULL(pcd.input_num,0) as inpuNum ,
|
||||
pcd.purchase_num - IFNULL(pcd.input_num,0) as waitNum
|
||||
FROM
|
||||
purchase_check_details pcd
|
||||
WHERE pcd.task_id = #{taskId} and pcd.type_id = #{maTypeId}
|
||||
AND pcd.status NOT IN (19)
|
||||
</select>
|
||||
|
||||
<update id="updateTaskStatus">
|
||||
UPDATE tm_task SET status = 22 WHERE task_id = #{taskId}
|
||||
</update>
|
||||
|
||||
<update id="updateStorageNum">
|
||||
update ma_type set storage_num = storage_num + #{inputNum} where type_id = #{typeId}
|
||||
</update>
|
||||
|
||||
<update id="updateBoxStatus">
|
||||
update bm_qrcode_box set box_status = 5 where box_id = #{boxId}
|
||||
</update>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue