add:成品出库手动分配
This commit is contained in:
@@ -109,5 +109,13 @@ public class IStivtlostorivnCpOutController {
|
||||
return new ResponseEntity<>(iStIvtIostorinvCpOutService.getStructIvt(whereJson),HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/manualDiv")
|
||||
@Log("手工分配保存")
|
||||
@ApiOperation("手工分配保存")
|
||||
public ResponseEntity<Object> manualDiv(@RequestBody JSONObject whereJson){
|
||||
iStIvtIostorinvCpOutService.manualDiv(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -131,4 +131,14 @@ public interface IStIvtIostorinvCpOutService extends IService<StIvtIostorinvCp>
|
||||
* }
|
||||
*/
|
||||
List getStructIvt(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 手工分配保存
|
||||
* @param whereJson
|
||||
* {
|
||||
* rows:库存,
|
||||
* iostorinvdtl_id:明细id,
|
||||
* }
|
||||
*/
|
||||
void manualDiv(JSONObject whereJson);
|
||||
}
|
||||
|
||||
@@ -59,6 +59,7 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -478,11 +479,59 @@ public class StIvtIostorinvCpOutServiceImpl extends ServiceImpl<StIvtIostorinvCp
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("materia_id", whereJson.getString("materia_id"));
|
||||
param.put("stor_id", whereJson.getString("stor_id"));
|
||||
if (ObjectUtil.isNotEmpty(whereJson.getString("sale_id"))) param.put("sale_id", whereJson.getString("sale_id"));
|
||||
if (ObjectUtil.isNotEmpty(whereJson.getString("source_billdtl_id"))) param.put("sale_id", whereJson.getString("source_billdtl_id"));
|
||||
if (ObjectUtil.isNotEmpty(whereJson.getString("search"))) param.put("remark", whereJson.getString("search"));
|
||||
if (ObjectUtil.isNotEmpty(whereJson.getString("sect_id"))) param.put("sect_id", whereJson.getString("sect_id"));
|
||||
|
||||
return iStIvtStructivtCpService.getStructIvt(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void manualDiv(JSONObject whereJson) {
|
||||
|
||||
JSONArray rows = whereJson.getJSONArray("rows");
|
||||
|
||||
// 1.组织要更新库存的集合
|
||||
ArrayList<StIvtStructivtCp> ivtDaoList = new ArrayList<>();
|
||||
|
||||
for (int i = 0; i < rows.size(); i++) {
|
||||
JSONObject jsonObject = rows.getJSONObject(i);
|
||||
StIvtStructivtCp ivtDao = iStIvtStructivtCpService.getById(jsonObject.getString("stockrecord_id"));
|
||||
ivtDao.setCanuse_qty(jsonObject.getBigDecimal("plan_qty"));
|
||||
|
||||
ivtDaoList.add(ivtDao);
|
||||
}
|
||||
|
||||
// 2.插入分配表
|
||||
StIvtIostorinvdtlCp dtlDao = iostorinvdtlCpService.getById(whereJson.getString("iostorinvdtl_id"));
|
||||
iostorinvdisCpService.onductDataOutDis(ivtDaoList,dtlDao);
|
||||
|
||||
// 3.更新明细状态
|
||||
BigDecimal assign_qty = ivtDaoList.stream()
|
||||
.map(StIvtStructivtCp::getCanuse_qty)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add); // 已分配数量
|
||||
|
||||
BigDecimal unassign_qty = NumberUtil.sub(dtlDao.getUnassign_qty(), assign_qty); // 未分配重量
|
||||
|
||||
if (unassign_qty.doubleValue() != 0) {
|
||||
dtlDao.setBill_status(IOSEnum.BILL_STATUS.code("分配中"));
|
||||
} else {
|
||||
dtlDao.setBill_status(IOSEnum.BILL_STATUS.code("分配完"));
|
||||
}
|
||||
|
||||
dtlDao.setUnassign_qty(unassign_qty);
|
||||
dtlDao.setAssign_qty(assign_qty);
|
||||
iostorinvdtlCpService.updateById(dtlDao);
|
||||
|
||||
// 4.更新库存冻结数 、 锁定仓位
|
||||
StIvtIostorinvCp mstDao = this.getById(dtlDao.getIostorinv_id());
|
||||
updateIvtDiv(ivtDaoList,mstDao);
|
||||
|
||||
// 5.更新主表
|
||||
updateMst(mstDao.getIostorinv_id());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private StIvtIostorinvCp packageMstForm(StIvtIostorinvCp stIvtIostorinvCp,JSONObject whereJson,Boolean isUpdate) {
|
||||
JSONArray rows = whereJson.getJSONArray("tableData");
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.wms.storage_manage.productmanage.service.structIvt.dao.StIvtStructivtCp;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -46,5 +47,5 @@ public interface IStIvtStructivtCpService extends IService<StIvtStructivtCp> {
|
||||
* 明细row
|
||||
* }
|
||||
*/
|
||||
List getStructIvt(JSONObject whereJson);
|
||||
List<Map> getStructIvt(JSONObject whereJson);
|
||||
}
|
||||
|
||||
@@ -28,10 +28,18 @@
|
||||
|
||||
<select id="getStructIvt" resultType="java.util.Map">
|
||||
SELECT
|
||||
ivt.*
|
||||
ivt.*,
|
||||
attr.sect_name,
|
||||
attr.struct_code,
|
||||
attr.storagevehicle_code,
|
||||
mater.material_code,
|
||||
mater.material_name,
|
||||
unit.unit_name AS qty_unit_name
|
||||
FROM
|
||||
ST_IVT_StructIvt_CP ivt
|
||||
LEFT JOIN st_ivt_structattr attr ON ivt.struct_id = attr.struct_id
|
||||
LEFT JOIN md_me_materialbase mater ON ivt.material_id = mater.material_id
|
||||
LEFT JOIN md_pb_measureunit unit ON unit.measure_unit_id = mater.base_unit_id
|
||||
WHERE attr.lock_type = '0'
|
||||
<if test="stor_id != null and stor_id != ''">
|
||||
and attr.stor_id = #{stor_id}
|
||||
@@ -45,6 +53,11 @@
|
||||
<if test="sale_id != null and sale_id != ''">
|
||||
and ivt.sale_id = #{sale_id}
|
||||
</if>
|
||||
<if test="remark != null and remark != ''">
|
||||
and attr.struct_code LIKE #{remark} OR
|
||||
(attr.struct_name LIKE #{remark}) OR
|
||||
(attr.storagevehicle_code LIKE #{remark})
|
||||
</if>
|
||||
order by ivt.canuse_qty ASC,ivt.struct_code ASC
|
||||
|
||||
</select>
|
||||
|
||||
@@ -23,6 +23,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -87,7 +88,7 @@ public class StIvtStructivtCpServiceImpl extends ServiceImpl<StIvtStructivtCpMap
|
||||
}
|
||||
|
||||
@Override
|
||||
public List getStructIvt(JSONObject whereJson) {
|
||||
public List<Map> getStructIvt(JSONObject whereJson) {
|
||||
return baseMapper.getStructIvt(whereJson);
|
||||
}
|
||||
|
||||
|
||||
@@ -212,7 +212,7 @@
|
||||
<el-table-column show-overflow-tooltip prop="point_code" width="150px" label="出库点" align="center" />
|
||||
</el-table>
|
||||
</el-card>
|
||||
<StructIvt :dialog-show.sync="structshow" :stor-id="storId" :open-array="openParam" :rowmst="openRow" @StructIvtClosed="queryTableDtl" />
|
||||
<StructIvt :dialog-show.sync="structshow" :stor-id="storId" :open-array="openParam" :rowmst="openRow" @StructIvtClosed="closeDiv" />
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
@@ -334,7 +334,12 @@ export default {
|
||||
|
||||
this.currentRow.remark = ''
|
||||
this.currentRow.stor_id = this.storId
|
||||
this.currentRow.assign_qty = 0
|
||||
productOut.getStructIvt(this.currentRow).then(res => {
|
||||
res.forEach(item => {
|
||||
item.edit = false
|
||||
})
|
||||
|
||||
this.openParam = res
|
||||
this.structshow = true
|
||||
this.openRow = this.currentRow
|
||||
@@ -361,6 +366,10 @@ export default {
|
||||
handleDisCurrentChange(current) {
|
||||
this.currentDis = current
|
||||
},
|
||||
closeDiv() {
|
||||
this.queryTableDtl()
|
||||
this.crud.notify('操作成功!', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
},
|
||||
queryTableDtl() {
|
||||
productOut.getIosInvDtl({ 'iostorinv_id': this.mstrow.iostorinv_id }).then(res => {
|
||||
this.tableDtl = res
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
</el-form-item>
|
||||
<el-form-item label="关键字" prop="remark">
|
||||
<el-input
|
||||
v-model="queryrow.remark"
|
||||
v-model="queryrow.search"
|
||||
clearable
|
||||
style="width: 220px"
|
||||
size="mini"
|
||||
@@ -82,7 +82,7 @@
|
||||
<el-table-column show-overflow-tooltip prop="material_name" label="物料名称" align="center" />
|
||||
<el-table-column show-overflow-tooltip prop="pcsn" label="批次号" align="center" />
|
||||
<el-table-column show-overflow-tooltip prop="canuse_qty" label="可出重量" :formatter="crud.formatNum3" align="center" />
|
||||
<el-table-column show-overflow-tooltip prop="plan_qty" label="重量" :formatter="crud.formatNum3" width="160" align="center">
|
||||
<el-table-column show-overflow-tooltip prop="plan_qty" label="出库重量" :formatter="crud.formatNum3" width="160" align="center">
|
||||
<template scope="scope">
|
||||
<el-input-number v-show="!scope.row.edit" v-model="scope.row.plan_qty" :precision="3" :max="100000000" />
|
||||
<span v-show="scope.row.edit">{{ scope.row.plan_qty }}</span>
|
||||
@@ -157,7 +157,13 @@ export default {
|
||||
queryStruct() {
|
||||
this.queryrow.unassign_qty = parseFloat(this.queryrow.unassign_qty) + parseFloat(this.queryrow.assign_qty)
|
||||
this.queryrow.assign_qty = 0
|
||||
this.queryrow.materia_id = this.rowmst.material_id
|
||||
this.queryrow.sale_id = this.rowmst.sale_id
|
||||
productOut.getStructIvt(this.queryrow).then(res => {
|
||||
res.forEach(item => {
|
||||
item.edit = false
|
||||
})
|
||||
|
||||
this.tableDtl = res
|
||||
})
|
||||
},
|
||||
@@ -217,7 +223,8 @@ export default {
|
||||
rows.push(item)
|
||||
}
|
||||
})
|
||||
checkoutbill.manualDiv({ 'row': this.queryrow, 'rows': rows }).then(res => {
|
||||
|
||||
productOut.manualDiv({ 'iostorinvdtl_id': this.queryrow.iostorinvdtl_id, 'rows': rows }).then(res => {
|
||||
this.$emit('update:dialogShow', false)
|
||||
this.$emit('StructIvtClosed')
|
||||
})
|
||||
@@ -230,7 +237,7 @@ export default {
|
||||
rows.push(item)
|
||||
}
|
||||
})
|
||||
checkoutbill.manualDiv({ 'row': this.queryrow, 'rows': rows }).then(res => {
|
||||
productOut.manualDiv({ 'iostorinvdtl_id': this.queryrow.iostorinvdtl_id, 'rows': rows }).then(res => {
|
||||
this.$emit('update:dialogShow', false)
|
||||
this.$emit('StructIvtClosed')
|
||||
})
|
||||
|
||||
@@ -80,6 +80,14 @@ export function getStructIvt(data) {
|
||||
})
|
||||
}
|
||||
|
||||
export function manualDiv(data) {
|
||||
return request({
|
||||
url: 'api/productOut/manualDiv',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export default {
|
||||
add,
|
||||
edit,
|
||||
@@ -90,5 +98,6 @@ export default {
|
||||
allCancel,
|
||||
setPoint,
|
||||
confirm,
|
||||
getStructIvt
|
||||
getStructIvt,
|
||||
manualDiv
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user