This commit is contained in:
2022-12-01 10:16:21 +08:00
parent 3c6b6b1c45
commit b4f1ee22c2
4 changed files with 119 additions and 1 deletions

View File

@@ -49,7 +49,7 @@
SELECT SELECT
sub.product_name AS material_code, sub.product_name AS material_code,
sub.product_description AS material_name, sub.product_description AS material_name,
sub.container_name AS pcsn, sub.sap_pcsn AS pcsn,
sub.sale_order_name AS mfgordername, sub.sale_order_name AS mfgordername,
sub.customer_name AS customername, sub.customer_name AS customername,
sub.customer_description AS customerdescription, sub.customer_description AS customerdescription,

View File

@@ -54,6 +54,7 @@
WHEN '1001' THEN '发货出库' WHEN '1001' THEN '发货出库'
WHEN '1002' THEN '报废出库' WHEN '1002' THEN '报废出库'
WHEN '1003' THEN '改切出库' WHEN '1003' THEN '改切出库'
WHEN '1004' THEN '调拨出库'
WHEN '1009' THEN '手工出库' WHEN '1009' THEN '手工出库'
END END
) AS bill_type_name, ) AS bill_type_name,

View File

@@ -274,6 +274,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
map.put("update_time", now); map.put("update_time", now);
map.put("is_delete", "0"); map.put("is_delete", "0");
map.put("is_upload", "0"); map.put("is_upload", "0");
map.put("out_stor_id",map.getString("out_stor_id"));
if (ObjectUtil.isNotEmpty(user)) { if (ObjectUtil.isNotEmpty(user)) {
if (!user.equals("mes") || user.equals("sap")) { if (!user.equals("mes") || user.equals("sap")) {
Long deptId = SecurityUtils.getDeptId(); Long deptId = SecurityUtils.getDeptId();
@@ -1934,6 +1935,88 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
subTab.update(jsonSub); subTab.update(jsonSub);
} }
JSONObject out_jo = WQLObject.getWQLObject("ST_IVT_IOStorInv").query("iostorinv_id = '"+iostorinv_id+"'").uniqueResult(0);
if (out_jo.getString("bill_type").equals("1004")){
//调拨出库自动生成调拨入库单
WQLObject dtl_wql = WQLObject.getWQLObject("st_ivt_iostorinvdtl");
WQLObject mst_wql = WQLObject.getWQLObject("ST_IVT_IOStorInv");
WQLObject dis_wql = WQLObject.getWQLObject("ST_IVT_IOStorInvDis");
//校验主表状态为生成
if (!out_jo.getString("bill_status").equals("99")) {
throw new BadRequestException("主表状态必须为完成!");
}
JSONObject mst_row = mst_wql.query("iostorinv_id = '" + iostorinv_id + "'").uniqueResult(0);
JSONArray dis_rows = dis_wql.query("iostorinv_id = '" + iostorinv_id + "'").getResultJSONArray(0);
//生成手工入库单
String new_iostorinv_id = IdUtil.getSnowflake(1, 1).nextId() + "";
String bill_code = CodeUtil.getNewCode("IO_CODE");
jo_mst.put("iostorinv_id", new_iostorinv_id);
jo_mst.put("bill_code", bill_code);
jo_mst.put("io_type", "0");
jo_mst.put("bill_type", "0004");
jo_mst.put("buss_type", ((String) jo_mst.get("bill_type")).substring(0, 4));
//查询移入仓库的信息
JSONObject in_stor = WQLObject.getWQLObject("st_ivt_bsrealstorattr").query("stor_id = '"+out_jo.getString("out_stor_id")+"'").uniqueResult(0);
if (ObjectUtil.isEmpty(in_stor)){
throw new BadRequestException("未查询到对应的移入仓库信息!");
}
jo_mst.put("stor_id",in_stor.getString("stor_id"));
jo_mst.put("stor_code",in_stor.getString("stor_code"));
jo_mst.put("stor_name",in_stor.getString("stor_name"));
jo_mst.put("bill_status", "30");
jo_mst.put("input_optid", currentUserId + "");
jo_mst.put("input_optname", nickName);
jo_mst.put("input_time", now);
jo_mst.put("update_optid", currentUserId + "");
jo_mst.put("update_optname", nickName);
jo_mst.put("update_time", now);
jo_mst.put("out_stor_id", "");
mst_wql.insert(jo_mst);
for (int i = 0; i < dis_rows.size(); i++) {
//插入明细表
String iostorinvdtl_id = IdUtil.getSnowflake(1, 1).nextId() + "";
JSONObject dis_row = dis_rows.getJSONObject(i);
//查询对应的出库单明细
JSONObject dtl_row = dtl_wql.query("iostorinvdtl_id = '" + dis_row.getString("iostorinvdtl_id") + "'").uniqueResult(0);
dis_row.put("iostorinvdtl_id", iostorinvdtl_id);
dis_row.put("iostorinv_id", new_iostorinv_id);
dis_row.put("seq_no", i + 1);
dis_row.put("bill_status", "30");
dis_row.put("real_qty", "0");
dis_row.put("source_billdtl_id", dtl_row.getString("iostorinvdtl_id"));
dis_row.put("source_bill_type", mst_row.getString("bill_type"));
dis_row.put("source_bill_code", mst_row.getString("bill_code"));
dis_row.put("source_bill_table", "ST_IVT_IOStorInvDtl");
dis_row.put("assign_qty", dis_row.getString("plan_qty"));
dis_row.put("unassign_qty", "0");
//插入调拨明细表
dtl_wql.insert(dis_row);
dis_row.put("iostorinvdis_id", IdUtil.getSnowflake(1, 1).nextId());
dis_row.put("seq_no", 1);
dis_row.put("sect_id", "");
dis_row.put("sect_code", "");
dis_row.put("sect_name", "");
dis_row.put("struct_id", "");
dis_row.put("struct_code", "");
dis_row.put("struct_name", "");
dis_row.put("work_status", "00");
dis_row.put("real_qty", "0");
//插入分配表
dis_wql.insert(dis_row);
//将包装关系中对应的记录状态改为包装
HashMap<String, String> map = new HashMap<>();
map.put("status", "1");
WQLObject.getWQLObject("PDM_BI_SubPackageRelation").update(map, "package_box_SN = '" + dis_row.getString("box_no") + "' AND status = '3'");
}
}
/* /*
* 回传: * 回传:
* 销售出库sap、mes * 销售出库sap、mes

View File

@@ -98,6 +98,25 @@
<el-form-item label="业务日期" prop="biz_date"> <el-form-item label="业务日期" prop="biz_date">
<el-date-picker v-model="form.biz_date" type="date" placeholder="选择日期" style="width: 210px" value-format="yyyy-MM-dd" :disabled="crud.status.view > 0" /> <el-date-picker v-model="form.biz_date" type="date" placeholder="选择日期" style="width: 210px" value-format="yyyy-MM-dd" :disabled="crud.status.view > 0" />
</el-form-item> </el-form-item>
<el-form-item label="移入仓库" prop="out_stor_id" v-if="form.bill_type === '1004'">
<label slot="label">移入仓库:</label>
<el-select
v-model="form.out_stor_id"
clearable
placeholder="仓库"
class="filter-item"
style="width: 210px"
:disabled="crud.status.view > 0"
@change="storChange"
>
<el-option
v-for="item in inStorList"
:key="item.stor_id"
:label="item.stor_name"
:value="item.stor_id"
/>
</el-select>
</el-form-item>
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<label slot="label">备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注:</label> <label slot="label">备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注:</label>
<el-input v-model="form.remark" style="width: 380px;" rows="2" type="textarea" :disabled="crud.status.view > 0" /> <el-input v-model="form.remark" style="width: 380px;" rows="2" type="textarea" :disabled="crud.status.view > 0" />
@@ -255,6 +274,7 @@ const defaultForm = {
bill_type: '', bill_type: '',
remark: '', remark: '',
biz_date: new Date(), biz_date: new Date(),
out_stor_id: '',
create_mode: '', create_mode: '',
tableData: [] tableData: []
} }
@@ -279,6 +299,7 @@ export default {
nowrow: {}, nowrow: {},
nowindex: '', nowindex: '',
storlist: [], storlist: [],
inStorList: [],
invtypelist: [], invtypelist: [],
rules: { rules: {
stor_id: [ stor_id: [
@@ -305,15 +326,28 @@ export default {
crudUserStor.getUserStor().then(res => { crudUserStor.getUserStor().then(res => {
this.storlist = res this.storlist = res
}) })
crudUserStor.queryStor({}).then(res => {
this.inStorList = res
})
}, },
close() { close() {
this.$emit('AddChanged') this.$emit('AddChanged')
}, },
[CRUD.HOOK.beforeSubmit]() { [CRUD.HOOK.beforeSubmit]() {
debugger
if (this.form.tableData.length === 0) { if (this.form.tableData.length === 0) {
this.crud.notify('请至少选择一条明细', CRUD.NOTIFICATION_TYPE.INFO) this.crud.notify('请至少选择一条明细', CRUD.NOTIFICATION_TYPE.INFO)
return false return false
} }
if (this.form.bill_type !== '1004') {
this.form.out_stor_id = ''
}
if (this.form.bill_type === '1004') {
if (this.form.out_stor_id === this.form.stor_id) {
this.crud.notify('移出仓库和移入仓库不能一致!', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
}
}, },
[CRUD.HOOK.afterToEdit]() { [CRUD.HOOK.afterToEdit]() {
checkoutbill.getOutBillDtl({ 'iostorinv_id': this.form.iostorinv_id }).then(res => { checkoutbill.getOutBillDtl({ 'iostorinv_id': this.form.iostorinv_id }).then(res => {