成套机具代码提交

This commit is contained in:
liang.chao 2024-04-23 09:19:37 +08:00
parent f94470a742
commit 62f2330ffb
10 changed files with 120 additions and 59 deletions

View File

@ -196,4 +196,6 @@ public interface BackReceiveMapper {
List<Integer> getMaId(BackApplyInfo backApplyInfo);
int selectNumByTypeId(@Param("parentId")Integer parentId,@Param("typeId") String typeId);
int selectTaskStatus(int taskId);
}

View File

@ -148,6 +148,11 @@ public class BackReceiveServiceImpl implements BackReceiveService {
int res;
try {
int taskId = record.getTaskId();
//先判断是否已经完成退料了
int taskStatus = selectTaskStatus(taskId);
if (taskStatus == 0) {
throw new RuntimeException("该退料单已完成退料");
}
//修改任务状态
res = updateTaskStatus(taskId, 40);
if (res == 0) {
@ -197,7 +202,7 @@ public class BackReceiveServiceImpl implements BackReceiveService {
if (allList != null && allList.size() > 0) {
res = updateSlt(record, allList);
if (res == 0) {
throw new RuntimeException("slt_agreement_info");
throw new RuntimeException("该机具未被领料使用");
}
}
} catch (Exception e) {
@ -206,6 +211,15 @@ public class BackReceiveServiceImpl implements BackReceiveService {
return res;
}
private int selectTaskStatus(int taskId) {
int taskStatus = backReceiveMapper.selectTaskStatus(taskId);
if (taskStatus == 40) {
return 0;
} else {
return 1;
}
}
private int updateSlt(BackApplyInfo record, List<BackApplyInfo> hgList) {
for (BackApplyInfo bean : hgList) {
List<SltAgreementInfo> infoList = backReceiveMapper.getStlInfo(bean);

View File

@ -35,7 +35,7 @@ public class WarehouseKeeperServiceImpl implements WarehouseKeeperService {
public int add(WarehouseKeeper bean) {
List<WarehouseKeeper> list = new ArrayList<>();
String typeIds = bean.getTypeIds();
if(StringHelper.isNotEmpty(typeIds)){
if (StringHelper.isNotEmpty(typeIds)) {
String[] splitTypeIds = typeIds.split("@");
//先删除在去添加
warehouseKeeperMapper.deleteByIdsAll(splitTypeIds);
@ -47,11 +47,9 @@ public class WarehouseKeeperServiceImpl implements WarehouseKeeperService {
list.add(beans);
}
}
int i =0;
if(list.size()>0){
i= warehouseKeeperMapper.add(list);
}else{
int i = 0;
if (list.size() > 0) {
i = warehouseKeeperMapper.add(list);
}
return i;
}
@ -59,11 +57,11 @@ public class WarehouseKeeperServiceImpl implements WarehouseKeeperService {
@Override
public int deleteByIds(WarehouseKeeper bean) {
int i = 1;
if(StringHelper.isNotEmpty(bean.getType())){
if("1".equals(bean.getType())){
if (StringHelper.isNotEmpty(bean.getType())) {
if ("1".equals(bean.getType())) {
warehouseKeeperMapper.deleteByIds(bean.getTypeIds());
}else{
if(StringHelper.isNotEmpty(bean.getTypeIds())){
} else {
if (StringHelper.isNotEmpty(bean.getTypeIds())) {
List<WarehouseKeeper> list = new ArrayList<>();
String[] splitTypeIds = bean.getTypeIds().split("@");
warehouseKeeperMapper.deleteByIdsAll(splitTypeIds);

View File

@ -667,7 +667,7 @@
mt2.type_name AS typeName,
bad.pre_num as preNum,
bad.status as status,
IFNULL(bad.audit_num,0)-IFNULL(aa.back_num,0) as partNum,
IFNULL(bad.audit_num,0)-IFNULL(aa.back_num,0) as num,
mt.manage_type as manageType,
CONCAT('NSJJ',mt.`code`,mt.model_code) as `code`
FROM
@ -931,6 +931,7 @@
<select id="getMaId" resultType="java.lang.Integer">
select ma_id from back_check_details where parent_id = #{parentId} and type_id = #{typeId}
</select>
<select id="selectTaskStatus" resultType="java.lang.Integer">
select task_status from tm_task where task_id = #{taskId}
</select>
</mapper>

View File

@ -5,6 +5,7 @@ import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.bonus.sgzb.common.security.utils.SecurityUtils;
import com.bonus.sgzb.material.domain.MachinePart;
import com.bonus.sgzb.material.domain.PurchaseInput;
import com.bonus.sgzb.material.service.IPurchaseCheckInfoService;
import com.bonus.sgzb.material.domain.PurchaseCheckInfo;
@ -23,15 +24,14 @@ import com.bonus.sgzb.common.core.web.page.TableDataInfo;
/**
* 新购验收任务
*
*
* @author bonus
* @date 2023-12-10
*/
@RestController
@Api(value = "新购验收任务")
@RequestMapping("/purchaseCheckInfo")
public class PurchaseCheckInfoController extends BaseController
{
public class PurchaseCheckInfoController extends BaseController {
@Autowired
private IPurchaseCheckInfoService purchaseCheckInfoService;
@ -52,20 +52,30 @@ public class PurchaseCheckInfoController extends BaseController
//若依框架多个查询会导致分页失效需分批处理
startPage();
list = purchaseCheckInfoService.selectPutInListExamine(purchaseCheckInfo);
}else {
} else {
startPage();
list = purchaseCheckInfoService.selectPutInListList(purchaseCheckInfo);
}
return getDataTable(list);
}
/**
* 成套机具明细查看
*/
@ApiOperation("成套机具明细查看")
@GetMapping("/wholeSetDetails")
public TableDataInfo wholeSetDetails(PurchaseCheckInfo purchaseCheckInfo) {
startPage();
List<MachinePart> list = purchaseCheckInfoService.getWholeSetDetails(purchaseCheckInfo);
return getDataTable(list);
}
/**
* 查询新购验收任务列表
*/
@ApiOperation("查询新购验收任务列表")
@GetMapping("/list")
public TableDataInfo list(PurchaseCheckInfo purchaseCheckInfo)
{
public TableDataInfo list(PurchaseCheckInfo purchaseCheckInfo) {
startPage();
List<PurchaseCheckInfo> list = purchaseCheckInfoService.selectPurchaseCheckInfoList(purchaseCheckInfo);
return getDataTable(list);
@ -77,8 +87,7 @@ public class PurchaseCheckInfoController extends BaseController
@ApiOperation("导出新购验收任务列表")
@Log(title = "新购验收任务", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, PurchaseCheckInfo purchaseCheckInfo)
{
public void export(HttpServletResponse response, PurchaseCheckInfo purchaseCheckInfo) {
List<PurchaseCheckInfo> list = purchaseCheckInfoService.exportList(purchaseCheckInfo);
ExcelUtil<PurchaseCheckInfo> util = new ExcelUtil<PurchaseCheckInfo>(PurchaseCheckInfo.class);
util.exportExcel(response, list, "新购验收任务数据");
@ -90,8 +99,7 @@ public class PurchaseCheckInfoController extends BaseController
@ApiOperation("导出新购工机具入库")
@Log(title = "导出新购工机具入库", businessType = BusinessType.EXPORT)
@PostMapping("/putInExport")
public void putInExport(HttpServletResponse response, PurchaseCheckInfo purchaseCheckInfo)
{
public void putInExport(HttpServletResponse response, PurchaseCheckInfo purchaseCheckInfo) {
List<PurchaseInput> list = purchaseCheckInfoService.putInExportList(purchaseCheckInfo);
ExcelUtil<PurchaseInput> util = new ExcelUtil<PurchaseInput>(PurchaseInput.class);
util.exportExcel(response, list, "新购工机具入库");
@ -103,9 +111,8 @@ public class PurchaseCheckInfoController extends BaseController
@ApiOperation("获取新购验收任务详细信息")
@GetMapping(value = "/getDetails")
public AjaxResult getInfo(@RequestParam(required = false) Long taskId,
@RequestParam(required = false) String keyWord)
{
return success(purchaseCheckInfoService.selectPurchaseCheckInfoByTaskId(taskId,keyWord));
@RequestParam(required = false) String keyWord) {
return success(purchaseCheckInfoService.selectPurchaseCheckInfoByTaskId(taskId, keyWord));
}
/**
@ -114,9 +121,8 @@ public class PurchaseCheckInfoController extends BaseController
@ApiOperation("获取新购验收任务验收单")
@GetMapping(value = "/getAcceptanceForm")
public AjaxResult getAcceptanceForm(@RequestParam(required = false) Long taskId,
@RequestParam(required = false) String keyWord)
{
return success(purchaseCheckInfoService.getAcceptanceForm(taskId,keyWord));
@RequestParam(required = false) String keyWord) {
return success(purchaseCheckInfoService.getAcceptanceForm(taskId, keyWord));
}
/**
@ -125,8 +131,7 @@ public class PurchaseCheckInfoController extends BaseController
@ApiOperation("新增新购验收任务")
@Log(title = "新购验收任务", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody PurchaseCheckInfo purchaseCheckInfo)
{
public AjaxResult add(@RequestBody PurchaseCheckInfo purchaseCheckInfo) {
return toAjax(purchaseCheckInfoService.insertPurchaseCheckInfo(purchaseCheckInfo));
}
@ -154,9 +159,8 @@ public class PurchaseCheckInfoController extends BaseController
*/
@ApiOperation("删除新购验收任务")
@Log(title = "新购验收任务", businessType = BusinessType.DELETE)
@DeleteMapping("/{taskId}")
public AjaxResult remove(@PathVariable Long taskId)
{
@DeleteMapping("/{taskId}")
public AjaxResult remove(@PathVariable Long taskId) {
return toAjax(purchaseCheckInfoService.deletePurchaseCheckInfoByTaskId(taskId));
}
}

View File

@ -1,6 +1,7 @@
package com.bonus.sgzb.material.mapper;
import com.bonus.sgzb.material.domain.BmNoticeInfo;
import com.bonus.sgzb.material.domain.MachinePart;
import com.bonus.sgzb.material.domain.PurchaseCheckInfo;
import com.bonus.sgzb.material.domain.PurchaseInput;
import org.apache.ibatis.annotations.Mapper;
@ -10,16 +11,15 @@ import java.util.List;
/**
* 新购验收任务purchase_check_infoMapper接口
*
*
* @author bonus
* @date 2023-12-10
*/
@Mapper
public interface PurchaseCheckInfoMapper
{
public interface PurchaseCheckInfoMapper {
/**
* 查询新购验收任务purchase_check_info
*
*
* @param taskId 新购验收任务purchase_check_info主键
* @return 新购验收任务purchase_check_info
*/
@ -27,7 +27,7 @@ public interface PurchaseCheckInfoMapper
/**
* 查询新购验收任务purchase_check_info列表
*
*
* @param purchaseCheckInfo 新购验收任务purchase_check_info
* @return 新购验收任务purchase_check_info集合
*/
@ -35,7 +35,7 @@ public interface PurchaseCheckInfoMapper
/**
* 新增新购验收任务purchase_check_info
*
*
* @param purchaseCheckInfo 新购验收任务purchase_check_info
* @return 结果
*/
@ -43,7 +43,7 @@ public interface PurchaseCheckInfoMapper
/**
* 修改新购验收任务purchase_check_info
*
*
* @param purchaseCheckInfo 新购验收任务purchase_check_info
* @return 结果
*/
@ -51,7 +51,7 @@ public interface PurchaseCheckInfoMapper
/**
* 删除新购验收任务purchase_check_info
*
*
* @param taskId 新购验收任务purchase_check_info主键
* @return 结果
*/
@ -59,7 +59,7 @@ public interface PurchaseCheckInfoMapper
/**
* 批量删除新购验收任务purchase_check_info
*
*
* @param taskIds 需要删除的数据主键集合
* @return 结果
*/
@ -67,14 +67,15 @@ public interface PurchaseCheckInfoMapper
/**
* 查询新购入库任务列表
* @param taskId
** @param type 1-验收2-入库
*
* @param taskId * @param type 1-验收2-入库
* @return
*/
String selectTypeNameByTaskId(@Param("taskId") Long taskId,@Param("type") String type);
String selectTypeNameByTaskId(@Param("taskId") Long taskId, @Param("type") String type);
/**
* 插入
*
* @param bmNoticeInfo
* @return
*/
@ -82,6 +83,7 @@ public interface PurchaseCheckInfoMapper
/**
* 查询
*
* @param purchaseCheckInfo
* @return
*/
@ -89,12 +91,15 @@ public interface PurchaseCheckInfoMapper
/**
* 新购验收
*
* @param purchaseCheckInfo
* @return
*/
List<PurchaseCheckInfo> exportList(PurchaseCheckInfo purchaseCheckInfo);
/**
* 新购入库导出
*
* @param purchaseCheckInfo
* @return
*/
@ -102,6 +107,7 @@ public interface PurchaseCheckInfoMapper
/**
* 查询
*
* @param purchaseCheckInfo
* @return
*/
@ -109,8 +115,11 @@ public interface PurchaseCheckInfoMapper
/**
* 查询 类型名称和管理类型
*
* @param taskId
* @return
*/
List<PurchaseCheckInfo> selectTypeNameAndManageTypeByTaskId(Long taskId);
List<MachinePart> getWholeSetDetails(PurchaseCheckInfo purchaseCheckInfo);
}

View File

@ -1,6 +1,7 @@
package com.bonus.sgzb.material.service;
import com.bonus.sgzb.material.domain.BmNoticeInfo;
import com.bonus.sgzb.material.domain.MachinePart;
import com.bonus.sgzb.material.domain.PurchaseCheckInfo;
import com.bonus.sgzb.material.domain.PurchaseInput;
import com.bonus.sgzb.material.vo.NoticeInfoVO;
@ -107,4 +108,6 @@ public interface IPurchaseCheckInfoService
* @return
*/
List<PurchaseCheckInfo> selectPutInListExamine(PurchaseCheckInfo purchaseCheckInfo);
List<MachinePart> getWholeSetDetails(PurchaseCheckInfo purchaseCheckInfo);
}

View File

@ -67,7 +67,7 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService {
public List<PurchaseCheckInfo> selectPutInListList(PurchaseCheckInfo purchaseCheckInfo) {
List<PurchaseCheckInfo> purchaseCheckInfos = purchaseCheckInfoMapper.selectPutInListList(purchaseCheckInfo);
for (PurchaseCheckInfo checkInfo : purchaseCheckInfos) {
String typeName = purchaseCheckInfoMapper.selectTypeNameByTaskId(checkInfo.getTaskId(),"2");
String typeName = purchaseCheckInfoMapper.selectTypeNameByTaskId(checkInfo.getTaskId(), "2");
checkInfo.setPurchasingTypeName(typeName);
}
return purchaseCheckInfos;
@ -101,12 +101,17 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService {
public List<PurchaseCheckInfo> selectPutInListExamine(PurchaseCheckInfo purchaseCheckInfo) {
List<PurchaseCheckInfo> purchaseCheckInfos = purchaseCheckInfoMapper.selectPutInListExamine(purchaseCheckInfo);
for (PurchaseCheckInfo checkInfo : purchaseCheckInfos) {
String typeName = purchaseCheckInfoMapper.selectTypeNameByTaskId(checkInfo.getTaskId(),"3");
String typeName = purchaseCheckInfoMapper.selectTypeNameByTaskId(checkInfo.getTaskId(), "3");
checkInfo.setPurchasingTypeName(typeName);
}
return purchaseCheckInfos;
}
@Override
public List<MachinePart> getWholeSetDetails(PurchaseCheckInfo purchaseCheckInfo) {
return purchaseCheckInfoMapper.getWholeSetDetails(purchaseCheckInfo);
}
/**
* 查询新购验收任务列表
*
@ -117,13 +122,13 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService {
public List<PurchaseCheckInfo> selectPurchaseCheckInfoList(PurchaseCheckInfo purchaseCheckInfo) {
List<PurchaseCheckInfo> purchaseCheckInfos = purchaseCheckInfoMapper.selectPurchaseCheckInfoList(purchaseCheckInfo);
for (PurchaseCheckInfo checkInfo : purchaseCheckInfos) {
String typeName="";
List<PurchaseCheckInfo> list = purchaseCheckInfoMapper.selectTypeNameAndManageTypeByTaskId(checkInfo.getTaskId());
if (list.size()>0){
String typeName = "";
List<PurchaseCheckInfo> list = purchaseCheckInfoMapper.selectTypeNameAndManageTypeByTaskId(checkInfo.getTaskId());
if (list.size() > 0) {
typeName = list.get(0).getPurchasingTypeName();
if (list.get(0).getManageType().contains("0")){
if (list.get(0).getManageType().contains("0")) {
checkInfo.setManageType("0");
}else {
} else {
checkInfo.setManageType("1");
}
}
@ -168,20 +173,22 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService {
return purchaseCheckInfoMapper.insertPurchaseCheckInfo(purchaseCheckInfo);
}
/**采购单号编码生成规则*/
/**
* 采购单号编码生成规则
*/
private String purchaseCodeRule() {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
Date nowDate = DateUtils.getNowDate();
String format = dateFormat.format(nowDate);
String taskNum = taskMapper.selectTaskNumByMonths(nowDate, 23);
if (StringHelper.isNotEmpty(taskNum)){
if (StringHelper.isNotEmpty(taskNum)) {
// 将字符串转换为整数
int num = Integer.parseInt(taskNum);
// 执行加一操作
num++;
// 将结果转换回字符串格式并确保结果是四位数不足四位则在前面补0
taskNum = String.format("%04d", num);
}else {
} else {
taskNum = "0001";
}
String code = "XG" + format + "-" + taskNum;

View File

@ -309,4 +309,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
) t
GROUP BY task_id
</select>
<select id="getWholeSetDetails" resultType="com.bonus.sgzb.material.domain.MachinePart">
SELECT
mt2.type_name AS typeModelName,
mt3.type_name AS typeName,
aa.part_num * #{purchaseNum} AS partNum,
mt2.unit_name as unitName
FROM
ma_type mt2
LEFT JOIN ma_type mt3 ON mt2.parent_id = mt3.type_id
INNER JOIN (
SELECT
mws.type_id,
mws.part_num
FROM
ma_type mt
LEFT JOIN ma_whole_set mws ON mt.type_id = mws.parent_id
WHERE
mt.type_id = #{typeId}
) aa ON aa.type_id = mt2.type_id
<if test="keyWord != null and keyWord != ''">
WHERE mt2.type_name like concat('%', #{keyWord}, '%')
</if>
</select>
</mapper>

View File

@ -401,7 +401,7 @@
</el-dialog>
</div>
</template>
<script>
import {
receiveView,
@ -885,4 +885,3 @@ export default {
cursor: pointer;
}
</style>