add::退料单增加targethource,增加分配及下推功能
This commit is contained in:
@@ -4,6 +4,7 @@ import org.nl.common.utils.MapOf;
|
||||
import org.nl.wms.ext_manage.purchase.service.dto.BillChangeDto;
|
||||
import org.nl.wms.ext_manage.service.dto.ZDInventory;
|
||||
import org.nl.wms.pm_manage.demand.service.dto.PmDemandDto;
|
||||
import org.nl.wms.pm_manage.pmreturn.service.dto.PmReturnDto;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
||||
import java.util.List;
|
||||
@@ -39,6 +40,13 @@ public interface WmsToZDWmdService {
|
||||
*/
|
||||
ResponseEntity syncDemandOrder(List<PmDemandDto> demands);
|
||||
|
||||
/**
|
||||
* 同步生产退料单
|
||||
* @param demands
|
||||
* @return
|
||||
*/
|
||||
ResponseEntity syncReturnOrder(List<PmReturnDto> demands);
|
||||
|
||||
/**
|
||||
* EAS入库单下发
|
||||
*/
|
||||
|
||||
@@ -14,6 +14,8 @@ import org.nl.wms.ext_manage.purchase.service.dto.BillChangeDto;
|
||||
import org.nl.wms.ext_manage.service.WmsToZDWmdService;
|
||||
import org.nl.wms.ext_manage.service.dto.ZDInventory;
|
||||
import org.nl.wms.pm_manage.demand.service.dto.PmDemandDto;
|
||||
import org.nl.wms.pm_manage.pmreturn.service.dao.PmReturn;
|
||||
import org.nl.wms.pm_manage.pmreturn.service.dto.PmReturnDto;
|
||||
import org.nl.wms.system_manage.enums.SysParamConstant;
|
||||
import org.nl.wms.system_manage.service.param.dao.Param;
|
||||
import org.nl.wms.system_manage.service.param.impl.SysParamServiceImpl;
|
||||
@@ -72,6 +74,30 @@ public class WmsToZDWmdServiceImpl implements WmsToZDWmdService {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ResponseEntity syncReturnOrder(List<PmReturnDto> pmReturns) {
|
||||
log.info("syncReturnOrder生产退料单下发输入参数:-------------------" + pmReturns.size());
|
||||
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode(SysParamConstant.ZD_URL_RETURN).getValue();
|
||||
try {
|
||||
//数据转换
|
||||
final String param = JSONObject.toJSONString(pmReturns);
|
||||
log.info("syncReturnOrder:-------------------" + param);
|
||||
String resultMsg = HttpRequest.post(url)
|
||||
.body(JSONArray.parseArray(param).toJSONString())
|
||||
.execute().body();
|
||||
JSONObject result = JSONObject.parseObject(resultMsg);
|
||||
log.info("syncReturnOrder生产退料单同步结果参数:-------------------" + result.toString());
|
||||
Integer respCode = result.getInteger("respCode");
|
||||
if (respCode == null || respCode != 0) {
|
||||
throw new BadRequestException("中鼎库存查询失败:" + result.getString("respMsg"));
|
||||
}
|
||||
return new ResponseEntity(result, HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
throw new BadRequestException("中鼎需求单下发失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity syncPurchaseReceiving(BillChangeDto billChangeDto) {
|
||||
final String param = JSON.toJSONString(billChangeDto);
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package org.nl.wms.pm_manage.pmreturn.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.common.base.ResponseData;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.pm_manage.pmreturn.service.IPmReturnService;
|
||||
import org.nl.wms.pm_manage.pmreturn.service.dto.PmReturnDto;
|
||||
@@ -61,4 +63,21 @@ public class PmReturnController {
|
||||
pmReturnService.deleteByIds(idList);
|
||||
return ResponseData.build();
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/allocate")
|
||||
@Log("分配仓库")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ResponseEntity<Object> allocate(@RequestBody PmReturnDto param) {
|
||||
pmReturnService.allocate(param);
|
||||
return ResponseData.build();
|
||||
}
|
||||
|
||||
@PostMapping("/upload")
|
||||
@Log("下推单子")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ResponseEntity<Object> upload(@RequestBody PmReturnDto param) {
|
||||
pmReturnService.upload(param);
|
||||
return ResponseData.build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.nl.wms.pm_manage.pmreturn.service.dao.PmReturn;
|
||||
import org.nl.wms.pm_manage.pmreturn.service.dto.PmReturnDto;
|
||||
import org.nl.wms.pm_manage.pmreturn.service.dto.PmReturnParam;
|
||||
import org.nl.wms.pm_manage.pmreturn.service.dto.PmReturnQuery;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -21,4 +22,6 @@ public interface IPmReturnService extends IService<PmReturn> {
|
||||
void update(PmReturnDto param);
|
||||
|
||||
void deleteByIds(List<String> ids);
|
||||
void allocate(PmReturnDto param);
|
||||
void upload(PmReturnDto param);
|
||||
}
|
||||
|
||||
@@ -56,6 +56,8 @@ public class PmReturn extends Model<PmReturn> {
|
||||
|
||||
@TableField("source_house_code")
|
||||
private String source_house_code;
|
||||
@TableField("target_house_code")
|
||||
private String target_house_code;
|
||||
|
||||
private Integer status;
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
<result property="creator" column="creator"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="sourceHouseCode" column="source_house_code"/>
|
||||
<result property="targetHouseCode" column="target_house_code"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="updateName" column="update_name"/>
|
||||
@@ -49,6 +50,9 @@
|
||||
<if test="query.sourceHouseCode != null and query.sourceHouseCode != ''">
|
||||
and source_house_code like concat('%', #{query.sourceHouseCode}, '%')
|
||||
</if>
|
||||
<if test="query.sourceHouseCode != null and query.sourceHouseCode != ''">
|
||||
and target_house_code like concat('%', #{query.targetHouseCode}, '%')
|
||||
</if>
|
||||
<if test="query.status != null">
|
||||
and status = #{query.status}
|
||||
</if>
|
||||
|
||||
@@ -22,6 +22,7 @@ public class PmReturnDto implements Serializable {
|
||||
private String creator;
|
||||
private String createTime;
|
||||
private String sourceHouseCode;
|
||||
private String targetHouseCode;
|
||||
private Integer status;
|
||||
private String updateTime;
|
||||
private String updateName;
|
||||
|
||||
@@ -53,6 +53,8 @@ public class PmReturnParam {
|
||||
@NotBlank(message = "来源仓别不能为空")
|
||||
private String sourceHouseCode;
|
||||
|
||||
private String targetHouseCode;
|
||||
|
||||
@NotNull(message = "状态不能为空")
|
||||
private Integer status;
|
||||
|
||||
|
||||
@@ -1,21 +1,43 @@
|
||||
package org.nl.wms.pm_manage.pmreturn.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.wms.basedata_manage.service.ISectattrService;
|
||||
import org.nl.wms.basedata_manage.service.IStructattrService;
|
||||
import org.nl.wms.basedata_manage.service.dao.Sectattr;
|
||||
import org.nl.wms.basedata_manage.service.dao.Structattr;
|
||||
import org.nl.wms.ext_manage.enums.EXTConstant;
|
||||
import org.nl.wms.ext_manage.service.WmsToZDWmdService;
|
||||
import org.nl.wms.pm_manage.pmreturn.service.IPmReturnService;
|
||||
import org.nl.wms.pm_manage.pmreturn.service.dao.PmReturn;
|
||||
import org.nl.wms.pm_manage.pmreturn.service.dao.mapper.PmReturnMapper;
|
||||
import org.nl.wms.pm_manage.pmreturn.service.dto.PmReturnDto;
|
||||
import org.nl.wms.pm_manage.pmreturn.service.dto.PmReturnParam;
|
||||
import org.nl.wms.pm_manage.pmreturn.service.dto.PmReturnQuery;
|
||||
import org.nl.wms.system_manage.service.param.ISysParamService;
|
||||
import org.nl.wms.system_manage.service.param.dao.Param;
|
||||
import org.nl.wms.warehouse_manage.enums.IOSEnum;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInvDis;
|
||||
import org.nl.wms.warehouse_manage.inventory.IStInventoryService;
|
||||
import org.nl.wms.warehouse_manage.inventory.core.enums.InventoryChangeType;
|
||||
import org.nl.wms.warehouse_manage.inventory.core.param.impl.InFinishParam;
|
||||
import org.nl.wms.warehouse_manage.inventory.core.param.impl.OutFinishParam;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static org.nl.common.domain.query.PageQuery.trimStringFields;
|
||||
@@ -23,6 +45,15 @@ import static org.nl.common.domain.query.PageQuery.trimStringFields;
|
||||
@Service
|
||||
public class PmReturnServiceImpl extends ServiceImpl<PmReturnMapper, PmReturn> implements IPmReturnService {
|
||||
|
||||
@Autowired
|
||||
private ISysParamService iSysParamService;
|
||||
@Autowired
|
||||
private WmsToZDWmdService wmsToZDWmdService;
|
||||
@Autowired
|
||||
private IStInventoryService iStInventoryService;
|
||||
@Autowired
|
||||
private IStructattrService iStructattrService;
|
||||
|
||||
@Override
|
||||
public Page<PmReturnDto> queryPage(PmReturnQuery query, PageQuery pageQuery) {
|
||||
trimStringFields(query);
|
||||
@@ -60,6 +91,7 @@ public class PmReturnServiceImpl extends ServiceImpl<PmReturnMapper, PmReturn> i
|
||||
entity.setCreator(param.getCreator());
|
||||
entity.setCreate_time(param.getCreateTime());
|
||||
entity.setSource_house_code(param.getSourceHouseCode());
|
||||
entity.setTarget_house_code(param.getTargetHouseCode());
|
||||
entity.setStatus(param.getStatus());
|
||||
entity.setUpdate_name(param.getUpdateName());
|
||||
entity.setUpdate_time(DateUtil.now());
|
||||
@@ -86,6 +118,7 @@ public class PmReturnServiceImpl extends ServiceImpl<PmReturnMapper, PmReturn> i
|
||||
entity.setDelivery_method(param.getDeliveryMethod());
|
||||
entity.setCreator(param.getCreator());
|
||||
entity.setCreate_time(param.getCreateTime());
|
||||
entity.setTarget_house_code(param.getTargetHouseCode());
|
||||
entity.setSource_house_code(param.getSourceHouseCode());
|
||||
entity.setStatus(param.getStatus());
|
||||
entity.setUpdate_name(param.getUpdateName());
|
||||
@@ -101,6 +134,69 @@ public class PmReturnServiceImpl extends ServiceImpl<PmReturnMapper, PmReturn> i
|
||||
this.removeByIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void allocate(PmReturnDto param) {
|
||||
final String targetHouseCode = param.getTargetHouseCode();
|
||||
if (StringUtils.isEmpty(targetHouseCode)) {
|
||||
throw new BadRequestException("分配失败,没有分配目标仓库");
|
||||
}
|
||||
// statusOptions: [
|
||||
// { value: 0, label: '生成' },
|
||||
// { value: 10, label: '分配' },
|
||||
// { value: 1, label: '失效' },
|
||||
// { value: 20, label: '执行' },
|
||||
// { value: 80, label: '完成' }
|
||||
// ],
|
||||
if (param.getStatus() != 0) {
|
||||
throw new BadRequestException("分配失败,当前单子状态已经分配");
|
||||
}
|
||||
param.setStatus(10);
|
||||
this.update(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void upload(PmReturnDto param) {
|
||||
final String targetHouseCode = param.getTargetHouseCode();
|
||||
if (StringUtils.isEmpty(targetHouseCode)){
|
||||
throw new BadRequestException("下推失败,当前单子未分配仓库");
|
||||
}
|
||||
Param zdStorParam = iSysParamService.findByCode(EXTConstant.ZD_STOR_SET);
|
||||
List ZD_STOR_SET;
|
||||
if (zdStorParam!=null){
|
||||
ZD_STOR_SET = JSONObject.parseObject(zdStorParam.getValue(), List.class);
|
||||
} else {
|
||||
ZD_STOR_SET = new ArrayList<>();
|
||||
}
|
||||
if (ZD_STOR_SET.contains(targetHouseCode)){
|
||||
//如果是中鼎仓库则推给中鼎并更新库存
|
||||
final List<PmReturnDto> request = new ArrayList<>();
|
||||
request.add(param);
|
||||
wmsToZDWmdService.syncReturnOrder(request);
|
||||
final List<InFinishParam> addInvParams = new ArrayList<>();
|
||||
InFinishParam addParam = new InFinishParam();
|
||||
List<OutFinishParam> outFinsParams = new ArrayList<>();
|
||||
//查询线边仓库对应虚拟货位
|
||||
final Structattr one = iStructattrService.getOne(new LambdaQueryWrapper<Structattr>()
|
||||
.eq(Structattr::getSect_code, param.getSourceHouseCode()));
|
||||
outFinsParams.add(OutFinishParam.builder()
|
||||
.storagevehicleCode(one.getStoragevehicle_code())
|
||||
.changeQty(param.getQty())
|
||||
.sectCode(param.getSourceHouseCode())
|
||||
.structCode(one.getStruct_code())
|
||||
.materialCode(param.getSkuCode())
|
||||
.build());
|
||||
addInvParams.add(addParam);
|
||||
iStInventoryService.changeInventory(InventoryChangeType.OUT_FINS, outFinsParams);
|
||||
param.setStatus(80);
|
||||
this.update(param);
|
||||
}{
|
||||
throw new BadRequestException("已经分配至平库,走打单入库流程");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private BigDecimal defaultAssignQty(BigDecimal assignQty) {
|
||||
return assignQty == null ? BigDecimal.ZERO : assignQty;
|
||||
}
|
||||
@@ -121,6 +217,7 @@ public class PmReturnServiceImpl extends ServiceImpl<PmReturnMapper, PmReturn> i
|
||||
dto.setCreator(entity.getCreator());
|
||||
dto.setCreateTime(entity.getCreate_time());
|
||||
dto.setSourceHouseCode(entity.getSource_house_code());
|
||||
dto.setTargetHouseCode(entity.getTarget_house_code());
|
||||
dto.setStatus(entity.getStatus());
|
||||
dto.setUpdateTime(entity.getUpdate_time());
|
||||
dto.setUpdateName(entity.getUpdate_name());
|
||||
|
||||
@@ -26,6 +26,7 @@ public class SysParamConstant {
|
||||
* 中鼎系统URL
|
||||
*/
|
||||
public final static String ZD_URL_REQUISITION = "ZD_URL_REQUISITION";
|
||||
public final static String ZD_URL_RETURN = "ZD_URL_RETURN";
|
||||
public final static String ZD_URL_LOC = "ZD_URL_LOC";
|
||||
public final static String ZD_URL_IOORDER = "ZD_URL_IOORDER";
|
||||
/**
|
||||
|
||||
@@ -165,7 +165,7 @@ public class StInventoryServiceImpl implements IStInventoryService {
|
||||
queryWrapper.eq(GroupPlate::getPcsn, outFinishParam.getPcsn());
|
||||
}
|
||||
GroupPlate groupPlate = iMdPbGroupplateService.getOne(queryWrapper);
|
||||
groupPlate.setFrozen_qty(groupPlate.getFrozen_qty().subtract(outFinishParam.getChangeQty()));
|
||||
groupPlate.setFrozen_qty(BigDecimal.ZERO.min(groupPlate.getFrozen_qty().subtract(outFinishParam.getChangeQty())));
|
||||
groupPlate.setQty(groupPlate.getQty().subtract(outFinishParam.getChangeQty()));
|
||||
groupPlate.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
groupPlate.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
|
||||
@@ -9,6 +9,11 @@
|
||||
<el-form-item label="退料单号">
|
||||
<el-input v-model="query.orderCode" size="mini" clearable placeholder="退料单号" @keyup.enter.native="crud.toQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态">
|
||||
<el-select v-model="query.status" clearable size="mini" placeholder="全部" class="filter-item" @change="crud.toQuery">
|
||||
<el-option v-for="item in statusOptions" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="物料编码">
|
||||
<el-input v-model="query.skuCode" size="mini" clearable placeholder="物料编码" @keyup.enter.native="crud.toQuery" />
|
||||
</el-form-item>
|
||||
@@ -43,20 +48,17 @@
|
||||
</div>
|
||||
<crudOperation :permission="permission">
|
||||
<el-button slot="right" class="filter-item" type="primary" icon="el-icon-printer" size="mini" :disabled="actionDisabled" @click="printBill">打印</el-button>
|
||||
<el-button slot="right" class="filter-item" type="success" icon="el-icon-s-promotion" size="mini" :disabled="isPushDisabled()" @click="handleBatchPush">下推单据</el-button>
|
||||
</crudOperation>
|
||||
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="mini" highlight-current-row style="width: 100%;" @selection-change="handleSelectionChange" @current-change="handleCurrentChange">
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column v-permission="['admin','pmReturn:del','pmReturn:edit']" label="操作" width="115" align="center" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<udOperation :data="scope.row" :permission="permission" :disabled-edit="canUd(scope.row)" :disabled-dle="canUd(scope.row)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column show-overflow-tooltip prop="orderCode" width="160" label="退料单号">
|
||||
<template slot-scope="scope">
|
||||
<el-link type="warning" @click="toView(scope.row)">{{ scope.row.orderCode }}</el-link>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column show-overflow-tooltip prop="serialNo" width="90" label="序号" />
|
||||
<el-table-column prop="status" width="100" label="状态" :formatter="statusFormat" />
|
||||
<el-table-column show-overflow-tooltip prop="skuCode" width="140" label="物料编码" />
|
||||
<el-table-column show-overflow-tooltip prop="skuName" min-width="180" label="物料名称" />
|
||||
<el-table-column prop="qty" width="100" label="数量" align="right" />
|
||||
@@ -68,9 +70,15 @@
|
||||
<el-table-column show-overflow-tooltip prop="creator" width="100" label="操作人工号" />
|
||||
<el-table-column show-overflow-tooltip prop="createTime" width="160" label="操作时间" />
|
||||
<el-table-column show-overflow-tooltip prop="sourceHouseCode" width="120" label="来源仓别" />
|
||||
<el-table-column prop="status" width="100" label="状态" :formatter="statusFormat" />
|
||||
<el-table-column show-overflow-tooltip prop="targetHouseCode" width="120" label="目标仓库" />
|
||||
<el-table-column show-overflow-tooltip prop="updateName" width="100" label="更新人" />
|
||||
<el-table-column show-overflow-tooltip prop="updateTime" width="160" label="更新时间" />
|
||||
<el-table-column label="操作" width="180px" align="center" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<udOperation style="display: inline" :data="scope.row" :permission="permission" />
|
||||
<el-button size="mini" type="warning" plain style="margin-left:4px;" @click="openAllocateDialog(scope.row)">分配</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination />
|
||||
</div>
|
||||
@@ -121,6 +129,22 @@
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer"><el-button type="primary" @click="viewShow = false">关闭</el-button></div>
|
||||
</el-dialog>
|
||||
<el-dialog :visible.sync="inventoryLoading" title="仓库分配" width="820px" :close-on-click-modal="false" @close="closeAllocateDialog">
|
||||
<div style="margin-bottom:10px;color:#606266;font-size:13px;">
|
||||
物料编码:<strong>{{ currentReturn.sku_code }}</strong> |
|
||||
需求数量:<strong style="color:#E6A23C;">{{ currentReturn.qty }} {{ currentReturn.unit }}</strong>
|
||||
</div>
|
||||
<el-table ref="allocateTable" :data="inventoryList" size="small" border @selection-change="handleInventorySelection">
|
||||
<el-table-column type="selection" width="45" />
|
||||
<el-table-column prop="label" label="仓库编号" min-width="130" show-overflow-tooltip />
|
||||
<el-table-column prop="value" label="物料编码" min-width="130" show-overflow-tooltip />
|
||||
</el-table>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button size="mini" @click="closeAllocateDialog">取消</el-button>
|
||||
<el-button size="mini" type="primary" :loading="!allocateSaving" @click="saveAllocate">保存分配</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -131,6 +155,7 @@ import rrOperation from '@crud/RR.operation.vue'
|
||||
import crudOperation from '@crud/CRUD.operation.vue'
|
||||
import udOperation from '@crud/UD.operation.vue'
|
||||
import pagination from '@crud/Pagination.vue'
|
||||
import {allocate, upload} from '@/views/wms/pm_manage/pmReturn/pmReturn'
|
||||
|
||||
const createDefaultForm = () => ({
|
||||
id: '',
|
||||
@@ -147,6 +172,7 @@ const createDefaultForm = () => ({
|
||||
creator: '',
|
||||
createTime: '',
|
||||
sourceHouseCode: '',
|
||||
targetHouseCode: '',
|
||||
status: 0,
|
||||
updateTime: '',
|
||||
updateName: ''
|
||||
@@ -169,7 +195,12 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
viewShow: false,
|
||||
inventoryLoading: false,
|
||||
currentRow: {},
|
||||
currentReturn: {},
|
||||
multipleSelection: [],
|
||||
selectedInventory: '',
|
||||
allocateSaving: false,
|
||||
actionDisabled: true,
|
||||
permission: {
|
||||
add: ['admin', 'pmReturn:add'],
|
||||
@@ -179,9 +210,15 @@ export default {
|
||||
statusOptions: [
|
||||
{ value: 0, label: '生成' },
|
||||
{ value: 1, label: '失效' },
|
||||
{ value: 10, label: '分配' },
|
||||
{ value: 20, label: '执行' },
|
||||
{ value: 80, label: '完成' }
|
||||
],
|
||||
inventoryList: [
|
||||
{ value: '6.002', label: '中鼎立库' },
|
||||
{ value: '6.011', label: '五期装配车间平库' },
|
||||
{ value: '6.011.01', label: '五期装配车间大件库' }
|
||||
],
|
||||
deliveryMethodOptions: [
|
||||
{ value: 1, label: '人工' },
|
||||
{ value: 2, label: 'AGV' }
|
||||
@@ -221,6 +258,11 @@ export default {
|
||||
const target = this.statusOptions.find(item => Number(item.value) === Number(status))
|
||||
return target ? target.label : status
|
||||
},
|
||||
isPushDisabled() {
|
||||
// 没有选中、选中多行、或选中的行状态不是 '0' 时禁用
|
||||
if (this.multipleSelection.length !== 1) return true
|
||||
return this.multipleSelection[0].status !== '10'
|
||||
},
|
||||
statusFormat(row) {
|
||||
return this.statusLabel(row.status)
|
||||
},
|
||||
@@ -234,6 +276,7 @@ export default {
|
||||
handleSelectionChange(selection) {
|
||||
this.crud.selectionChangeHandler(selection)
|
||||
this.actionDisabled = !selection || selection.length === 0
|
||||
this.multipleSelection = selection
|
||||
},
|
||||
handleCurrentChange(currentRow) {
|
||||
this.currentRow = currentRow || {}
|
||||
@@ -243,6 +286,74 @@ export default {
|
||||
this.currentRow = { ...row }
|
||||
this.viewShow = true
|
||||
},
|
||||
openAllocateDialog(row) {
|
||||
this.inventoryLoading = true
|
||||
this.currentReturn = row
|
||||
this.allocateSaving = false
|
||||
},
|
||||
closeAllocateDialog() {
|
||||
this.inventoryLoading = false
|
||||
this.currentReturn = {}
|
||||
this.selectedInventory = ''
|
||||
this.allocateSaving = false
|
||||
},
|
||||
handleInventorySelection(selection) {
|
||||
// 如果选中了多个,只保留最后一个
|
||||
if (selection.length > 1) {
|
||||
this.selectedInventory = ''
|
||||
this.allocateSaving = false
|
||||
} else if (selection.length === 1) {
|
||||
this.selectedInventory = selection[0].value
|
||||
this.allocateSaving = true
|
||||
} else {
|
||||
this.selectedInventory = ''
|
||||
this.allocateSaving = false
|
||||
}
|
||||
},
|
||||
saveAllocate() {
|
||||
if (!this.selectedInventory) {
|
||||
this.$message.warning('请至少勾选一条库存记录')
|
||||
return
|
||||
}
|
||||
this.currentReturn.targetHouseCode = this.selectedInventory
|
||||
allocate(this.currentReturn).then(res => {
|
||||
if (res.code == 400){
|
||||
this.$message.warning('分配失败'+res.message)
|
||||
return
|
||||
}
|
||||
this.$message.success('分配成功')
|
||||
this.crud.toQuery()
|
||||
}).finally(() => {
|
||||
this.closeAllocateDialog()
|
||||
})
|
||||
},
|
||||
handleBatchPush() {
|
||||
if (!this.multipleSelection.length) {
|
||||
this.$message.warning('请先勾选要下推的需求单')
|
||||
return
|
||||
}
|
||||
const invalidRows = this.multipleSelection.filter(item => String(item.status) !== '10')
|
||||
if (invalidRows.length) {
|
||||
this.$message.warning('仅支持批量下推状态为“分配”的需求单')
|
||||
return
|
||||
}
|
||||
this.$confirm(`确认批量下推已勾选的 ${this.multipleSelection.length} 条需求单吗?`, '提示', {
|
||||
confirmButtonText: '确认',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
upload(this.multipleSelection).then(res => {
|
||||
if (res.code == 400){
|
||||
this.$message.warning('分配失败'+res.message)
|
||||
return
|
||||
}
|
||||
this.$message.success('下推成功')
|
||||
this.crud.toQuery()
|
||||
}).catch(() => {
|
||||
this.$message.error('下推失败')
|
||||
})
|
||||
}).catch(() => {})
|
||||
},
|
||||
printBill() {
|
||||
const selections = this.crud.selections
|
||||
if (!selections || selections.length === 0) {
|
||||
|
||||
@@ -31,4 +31,20 @@ export function get(id) {
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, get }
|
||||
export function allocate(data) {
|
||||
return request({
|
||||
url: 'api/pmReturn/allocate',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function upload(data) {
|
||||
return request({
|
||||
url: 'api/pmReturn/upload',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, get, allocate }
|
||||
|
||||
Reference in New Issue
Block a user