MES:生产工单增加销售类型,支持外部销售和对内生产的创建和修改(用于四楼制造的成品发往五楼作为五楼的原材料生产)
master
xins 6 months ago
parent bbc5be0c4c
commit 5fd7f67f7c

@ -4,6 +4,8 @@ import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.hw.common.security.utils.SecurityUtils;
import com.hw.mes.domain.MesSaleOrder;
import com.hw.mes.service.IMesSaleOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@ -35,6 +37,9 @@ public class MesProductOrderController extends BaseController {
@Autowired
private IMesProductOrderService mesProductOrderService;
@Autowired
private IMesSaleOrderService mesSaleOrderService;
/**
*
*/
@ -137,4 +142,19 @@ public class MesProductOrderController extends BaseController {
return success(mesProductOrderService.verifyBOMIsProduction(materialBomId));
}
/**
*
*/
@RequiresPermissions("mes:productOrder:query")
@GetMapping("/getSaleOrders")
public TableDataInfo getSaleOrders(MesSaleOrder mesSaleOrder)
{
startPage();
List<MesSaleOrder> list = mesSaleOrderService.selectMesSaleOrderJoinMaterialList(mesSaleOrder);
return getDataTable(list);
}
}

@ -53,6 +53,12 @@ public class MesProductOrder extends BaseEntity {
@Excel(name = "项目编号")
private String projectNo;
/**
*
*/
@Excel(name = "销售类型1外部销售 2对内生产 3集装箱生产)")
private String saleType;
/**
* ID,mes_base_material_infomaterial_id;
*/
@ -281,6 +287,14 @@ public class MesProductOrder extends BaseEntity {
return projectNo;
}
public String getSaleType() {
return saleType;
}
public void setSaleType(String saleType) {
this.saleType = saleType;
}
public void setMaterialId(Long materialId) {
this.materialId = materialId;
}

@ -58,4 +58,13 @@ public interface MesSaleOrderMapper
* @return
*/
public int deleteMesSaleOrderBySaleOrderIds(Long[] saleOrderIds);
/**
* ,Join mes_base_material_info(material_idmes_base_material_infomaterial_id)
*
* @param mesSaleOrder
* @return
*/
public List<MesSaleOrder> selectMesSaleOrderJoinMaterialList(MesSaleOrder mesSaleOrder);
}

@ -58,4 +58,12 @@ public interface IMesSaleOrderService
* @return
*/
public int deleteMesSaleOrderBySaleOrderId(Long saleOrderId);
/**
* ,Join mes_base_material_info(material_idmes_base_material_infomaterial_id)
*
* @param mesSaleOrder
* @return
*/
public List<MesSaleOrder> selectMesSaleOrderJoinMaterialList(MesSaleOrder mesSaleOrder);
}

@ -136,13 +136,16 @@ public class MesProductOrderServiceImpl implements IMesProductOrderService {
if (StringUtils.isNull(mesProductOrder.getPlanAmount()) || StringUtils.isNull(mesProductOrder.getSaleAmount())) {
return;
}
MesProductOrder productOrder = new MesProductOrder();
productOrder.setSaleOrderId(mesProductOrder.getSaleOrderId());
List<MesProductOrder> mesProductOrders = mesProductOrderMapper.selectMesProductOrderList(productOrder);
BigDecimal sumDecimal = new BigDecimal(0);
if (StringUtils.isNotNull(mesProductOrders)) {
for (MesProductOrder order : mesProductOrders) {
if (!order.getOrderStatus().equals(MesConstants.RECALL) && !order.getProductOrderId().equals(mesProductOrder.getProductOrderId())) {
if (!order.getOrderStatus().equals(MesConstants.RECALL)
&& !order.getProductOrderId().equals(mesProductOrder.getProductOrderId())
&& order.getSaleType().equals(mesProductOrder.getSaleType())) {
sumDecimal = sumDecimal.add(order.getPlanAmount());
}
}

@ -93,4 +93,18 @@ public class MesSaleOrderServiceImpl implements IMesSaleOrderService
{
return mesSaleOrderMapper.deleteMesSaleOrderBySaleOrderId(saleOrderId);
}
/**
* ,Join mes_base_material_info(material_idmes_base_material_infomaterial_id)
*
* @param mesSaleOrder
* @return
*/
@Override
public List<MesSaleOrder> selectMesSaleOrderJoinMaterialList(MesSaleOrder mesSaleOrder)
{
return mesSaleOrderMapper.selectMesSaleOrderJoinMaterialList(mesSaleOrder);
}
}

@ -11,6 +11,7 @@
<result property="saleorderCode" column="saleorder_code"/>
<result property="saleorderLinenumber" column="saleorder_linenumber"/>
<result property="projectNo" column="project_no"/>
<result property="saleType" column="sale_type"/>
<result property="materialId" column="material_id"/>
<result property="materialBomId" column="material_bom_id"/>
<result property="dispatchType" column="dispatch_type"/>
@ -47,6 +48,7 @@
mpo.saleorder_code,
mpo.saleorder_linenumber,
mpo.project_no,
mpo.sale_type,
mpo.material_id,
mpo.material_bom_id,
concat(mb.material_name, '-', mb.material_bom_desc) material_bom_desc,
@ -135,6 +137,7 @@
<if test="saleorderCode != null and saleorderCode != ''">saleorder_code,</if>
<if test="saleorderLinenumber != null">saleorder_linenumber,</if>
<if test="projectNo != null">project_no,</if>
<if test="saleType != null and saleType != ''">sale_type,</if>
<if test="materialId != null">material_id,</if>
<if test="materialBomId != null">material_bom_id,</if>
<if test="dispatchType != null and dispatchType != ''">dispatch_type,</if>
@ -164,6 +167,7 @@
<if test="saleorderCode != null and saleorderCode != ''">#{saleorderCode},</if>
<if test="saleorderLinenumber != null">#{saleorderLinenumber},</if>
<if test="projectNo != null">#{projectNo},</if>
<if test="saleType != null and saleType != ''">#{saleType},</if>
<if test="materialId != null">#{materialId},</if>
<if test="materialBomId != null">#{materialBomId},</if>
<if test="dispatchType != null and dispatchType != ''">#{dispatchType},</if>
@ -197,6 +201,7 @@
<if test="saleorderCode != null and saleorderCode != ''">saleorder_code = #{saleorderCode},</if>
<if test="saleorderLinenumber != null">saleorder_linenumber = #{saleorderLinenumber},</if>
<if test="projectNo != null">project_no = #{projectNo},</if>
<if test="saleType != null and saleType != ''">sale_type = #{saleType},</if>
<if test="materialId != null">material_id = #{materialId},</if>
<if test="materialBomId != null">material_bom_id = #{materialBomId},</if>
<if test="dispatchType != null and dispatchType != ''">dispatch_type = #{dispatchType},</if>

@ -212,4 +212,36 @@
#{saleOrderId}
</foreach>
</delete>
<select id="selectMesSaleOrderJoinMaterialList" parameterType="MesSaleOrder" resultMap="MesSaleOrderResult">
select mso.sale_order_id,
mso.saleorder_code,
mso.document_status,
mbmi.material_id,
mso.material_code,
mso.material_name,
mso.order_amount,
mso.complete_amount,
mso.release_qty,
mso.is_release,
mso.plan_delivery_date,
mso.begin_date,
mso.end_date,
mso.complete_date
from mes_sale_order mso left join mes_base_material_info mbmi on mso.material_id = mbmi.erp_id
<where>
<if test="saleorderCode != null and saleorderCode != ''">and mso.saleorder_code = #{saleorderCode}</if>
<if test="materialCode != null and materialCode != ''">and mso.material_code = #{materialCode}</if>
<if test="materialName != null and materialName != ''">and mso.material_name like concat('%', #{materialName},
'%')
</if>
</where>
</select>
</mapper>

@ -85,3 +85,14 @@ export function verifyBOMIsProduction(materialBomId) {
method: 'get'
})
}
// 查询销售订单列表
export function getSaleOrders(query) {
return request({
url: '/mes/productOrder/getSaleOrders',
method: 'get',
params: query
})
}

@ -9,16 +9,6 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="单据状态" prop="documentStatus">
<el-select v-model="queryParams.documentStatus" placeholder="请选择单据状态" clearable>
<el-option
v-for="dict in dict.type.document_status"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<!-- <el-form-item label="所属工厂" prop="factoryId">-->
<!-- <el-input-->
<!-- v-model="queryParams.factoryId"-->
@ -113,7 +103,6 @@
<el-table-column label="ERP主键" align="center" prop="erpId" v-if="columns[1].visible"/>
<el-table-column label="ERP订单明细ID" align="center" prop="fentryId" v-if="columns[2].visible"/>
<el-table-column label="销售订单编号" align="center" prop="saleorderCode" width="100" v-if="columns[3].visible"/>
<el-table-column label="销售订单行号" align="center" prop="saleorderLinenumber" width="110" v-if="columns[4].visible"/>
<el-table-column label="单据状态" align="center" prop="documentStatus" v-if="columns[5].visible" >
<template slot-scope="scope">
<dict-tag :options="dict.type.document_status" :value="scope.row.documentStatus"/>
@ -125,7 +114,7 @@
<el-table-column label="物料编码" align="center" prop="materialCode" width="100" v-if="columns[9].visible"/>
<el-table-column label="物料名称" align="center" prop="materialName" width="100" v-if="columns[10].visible"/>
<el-table-column label="物料组" align="center" prop="matkl" v-if="columns[11].visible"/>
<el-table-column label="订单计划数量" align="center" prop="orderAmount" v-if="columns[12].visible"/>
<el-table-column label="订单数量" align="center" prop="orderAmount" v-if="columns[12].visible"/>
<el-table-column label="完成数量" align="center" prop="completeAmount" v-if="columns[13].visible"/>
<el-table-column label="已发布数量" align="center" prop="releaseQty" v-if="columns[14].visible"/>
<el-table-column label="是否已下达计划" align="center" prop="isRelease" v-if="columns[15].visible" >
@ -163,11 +152,6 @@
<span>{{ parseTime(scope.row.completeDate, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="是否标识" align="center" prop="isFlag" v-if="columns[22].visible" >
<template slot-scope="scope">
<dict-tag :options="dict.type.active_flag" :value="scope.row.isFlag"/>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" v-if="columns[23].visible"/>
</el-table>
@ -305,6 +289,7 @@
<script>
import { listSaleOrder, getSaleOrder, delSaleOrder, addSaleOrder, updateSaleOrder } from "@/api/mes/saleOrder";
import {getSaleOrders} from "@/api/mes/productOrder"
export default {
name: "SaleOrder",
@ -403,7 +388,7 @@ export default {
/** 查询销售订单信息列表 */
getList() {
this.loading = true;
listSaleOrder(this.queryParams).then(response => {
getSaleOrders(this.queryParams).then(response => {
this.saleOrderList = response.rows;
this.total = response.total;
this.loading = false;

@ -125,11 +125,15 @@
<el-table v-loading="loading" :data="productOrderList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"/>
<el-table-column label="主键标识" align="center" prop="productOrderId" v-if="columns[0].visible"/>
<el-table-column label="工单编号" align="center" prop="orderCode" v-if="columns[1].visible" width="100"/>
<el-table-column label="销售类型" align="center" prop="saleType" v-if="columns[28].visible" width="100">
<template slot-scope="scope">
<dict-tag :options="dict.type.mes_sale_type" :value="scope.row.saleType"/>
</template>
</el-table-column>
<el-table-column label="销售订单ID" align="center" prop="saleOrderId" v-if="columns[2].visible" width="100"/>
<el-table-column label="销售订单编号" align="center" prop="saleorderCode" v-if="columns[3].visible" width="100"/>
<el-table-column label="销售订单行号" align="center" prop="saleorderLinenumber" v-if="columns[4].visible" width="110"/>
<el-table-column label="项目编号" align="center" prop="projectNo" v-if="columns[5].visible"/>
<el-table-column label="工单编号" align="center" prop="orderCode" v-if="columns[1].visible" width="100"/>
<el-table-column label="物料名称" align="center" prop="materialName" v-if="columns[6].visible" width="100"/>
<el-table-column label="物料BOM" align="center" prop="materialBomDesc" v-if="columns[7].visible" width="120"/>
<el-table-column label="派工类型" align="center" prop="dispatchType" v-if="columns[8].visible">
@ -157,7 +161,8 @@
<span>{{ parseTime(scope.row.releaseTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
</el-table-column>
<el-table-column label="计划交货日期" align="center" prop="planDeliveryDate" width="180" v-if="columns[26].visible">
<el-table-column label="计划交货日期" align="center" prop="planDeliveryDate" width="180"
v-if="columns[26].visible">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
</template>
@ -260,26 +265,38 @@
<el-form-item label="工单编号" prop="orderCode">
<el-input v-model="form.orderCode" placeholder="请输入工单编号" :disabled="true"/>
</el-form-item>
<el-form-item label="销售类型" prop="saleType">
<el-radio-group v-model="form.saleType" @input="changeSaleType">
<el-radio
v-for="dict in dict.type.mes_sale_type"
:key="dict.value"
:label="dict.value"
>{{ dict.label }}
</el-radio>
</el-radio-group>
</el-form-item>
<!-- <el-form-item label="销售订单ID" prop="saleOrderId">-->
<!-- <el-input v-model="form.saleOrderId" placeholder="请输入销售订单ID" />-->
<!-- </el-form-item>-->
<el-form-item label="销售订单编号" prop="saleorderCode">
<el-input v-model="form.saleorderCode" placeholder="请点击右侧检索销售订单编号" readonly>
<el-input v-model="form.saleorderCode" placeholder="请点击右侧检索销售订单编号" :disabled="saleOrderDisabled" readonly>
<el-button slot="append" icon="el-icon-search" @click="handleSaleOrderAdd"></el-button>
</el-input>
</el-form-item>
<el-form-item label="销售订单行号" prop="saleorderLinenumber">
<el-input v-model="form.saleorderLinenumber" placeholder="请输入销售订单行号" :disabled="true"/>
</el-form-item>
<!-- <el-form-item label="项目编号" prop="projectNo">-->
<!-- <el-input v-model="form.projectNo" placeholder="请输入项目编号" />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="物料ID" prop="materialId" >-->
<!-- <el-input v-model="form.materialId" placeholder="请输入物料ID" :disabled="true"/>-->
<!-- </el-form-item>-->
<el-form-item label="物料名称" prop="materialId">
<el-input v-model="form.materialName" placeholder="请输入物料名称" :disabled="true"/>
<el-form-item label="物料名称" prop="materialName">
<el-input v-model="form.materialName" placeholder="请点击右侧检索物料" :disabled="materialDisabled" readonly>
<el-button slot="append" icon="el-icon-search" @click="handleMaterialAdd"></el-button>
</el-input>
</el-form-item>
<el-form-item label="物料BOM" prop="materialBomId">
<el-select v-model="form.materialBomId" placeholder="请选择物料BOM">
<el-option
@ -346,9 +363,16 @@
<el-form-item label="工单编号" prop="orderCode">
<el-input v-model="form.orderCode" :disabled="true"/>
</el-form-item>
<!-- <el-form-item label="项目编号" prop="projectNo">-->
<!-- <el-input v-model="form.projectNo" placeholder="请输入项目编号"/>-->
<!-- </el-form-item>-->
<el-form-item label="销售类型" prop="saleType">
<el-radio-group v-model="form.saleType">
<el-radio
v-for="dict in dict.type.mes_sale_type"
:key="dict.value"
:label="dict.value"
>{{ dict.label }}
</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="物料名称" prop="materialName">
<el-input v-model="form.materialName" placeholder="请点击右侧检索物料" readonly>
<el-button slot="append" icon="el-icon-search" @click="handleMaterialAdd"></el-button>
@ -452,7 +476,7 @@ import router from "@//router";
export default {
name: "ProductOrder",
dicts: ['active_flag', 'plan_status', 'dispatch_type'],
dicts: ['active_flag', 'plan_status', 'dispatch_type', 'mes_sale_type'],
components: {
'add-SaleOrder': addSaleOrder,
'add-bom': addBom
@ -525,11 +549,14 @@ export default {
saleOrderId: [
{required: true, message: "销售订单ID不能为空", trigger: "blur"}
],
saleType: [
{required: true, message: "销售类型不能为空", trigger: "blur"}
],
saleorderCode: [
{required: true, message: "销售订单编号不能为空", trigger: "blur"}
],
materialId: [
{required: true, message: "物料ID不能为空", trigger: "blur"}
materialName: [
{required: true, message: "物料名称不能为空", trigger: "blur"}
],
materialBomId: [
{required: true, message: "物料BOM不能为空", trigger: "blur"}
@ -593,11 +620,20 @@ export default {
{key: 25, label: `更新时间`, visible: false},
{key: 26, label: `计划交货日期`, visible: true},
{key: 27, label: `单位时间`, visible: true},
{key: 28, label: `销售类型`, visible: true},
],
//BOM
materialBomList: [],
//线
routeList: [],
saleOrderDisabled: true,
materialDisabled: true,
//
MES_SALE_TYPE: {
MES_SALE_TYPE_EXTERNAL: '1',//
MES_SALE_TYPE_INTERNAL: '2',//
}
};
},
created() {
@ -609,6 +645,7 @@ export default {
this.routeList = response.data;
})
},
methods: {
/** 查询生产工单列表 */
getList() {
@ -671,6 +708,10 @@ export default {
},
/** 新增按钮操作 */
handleSaleOrderAdd() {
if(this.form.saleType===null || this.form.saleType===undefined || this.form.saleType===''){
this.$modal.msgWarning("请先选择销售类型!");
return;
}
this.saleOrderOpen = true;
},
//
@ -709,28 +750,64 @@ export default {
this.form.saleOrderId = selectedRow.saleOrderId;
this.form.saleorderCode = selectedRow.saleorderCode;
this.form.saleorderLinenumber = selectedRow.saleorderLinenumber;
this.form.materialId = selectedRow.materialId;
this.form.materialCode = selectedRow.materialCode;
this.form.materialName = selectedRow.materialName;
this.form.saleAmount = selectedRow.orderAmount;
this.form.planBeginTime = selectedRow.beginDate == null ? null : selectedRow.beginDate + " 00:00:00";
this.form.planEndTime = selectedRow.endDate == null ? null : selectedRow.endDate + " 00:00:00";
this.form.planDeliveryDate = selectedRow.planDeliveryDate == null ? null : selectedRow.planDeliveryDate + " 00:00:00";
this.form.saleOrderFlag = '1';
getMaterialVisionList(selectedRow.materialId).then(response => {
if (selectedRow.materialId === null || selectedRow.materialId === undefined || selectedRow.materialId === "") {
this.$modal.msgError("该销售订单销售成品信息不存在!");
return;
}
if (this.form.saleType && this.form.saleType === this.MES_SALE_TYPE.MES_SALE_TYPE_EXTERNAL) {
this.form.materialId = selectedRow.materialId;
this.form.materialCode = selectedRow.materialCode;
this.form.materialName = selectedRow.materialName;
this.getMaterialVisionList();
}
this.saleOrderOpen = false;
},
changeSaleType(value) {
this.form.saleOrderId =null;
this.form.saleorderCode = null;
this.form.saleorderLinenumber = null;
this.form.materialId = null;
this.form.materialCode = null;
this.form.materialName = null;
this.form.saleAmount = null;
this.form.planBeginTime = null;
this.form.planEndTime = null;
this.form.planDeliveryDate = null;
this.form.materialBomId = null;
this.form.dispatchId = null;
this.form.saleOrderFlag = '1';//
this.saleOrderDisabled = false;
if (value == this.MES_SALE_TYPE.MES_SALE_TYPE_EXTERNAL) {
this.materialDisabled = true;
} else {
this.materialDisabled = false;
}
},
getMaterialVisionList() {
getMaterialVisionList(this.form.materialId).then(response => {
this.materialBomList = response.data
if (this.materialBomList.length !== 0) {
this.form.materialBomId = this.materialBomList[0].materialBomId;
} else {
this.form.materialBomId = null;
this.$modal.msgError("该销售订单物料未维护BOM信息");
this.$modal.msgError("该物料未维护BOM信息");
}
})
this.saleOrderOpen = false;
},
/** 新增按钮操作 */
handleAdd() {
this.materialDisabled = true;
this.reset();
getOrderCode().then(response => {
this.form.orderCode = response.msg;
@ -741,11 +818,14 @@ export default {
/** 新增按钮操作 */
handleMaterialAdd() {
if (!this.materialDisabled) {
this.materialOpen = true;
}
},
/** 无订单新增按钮操作 */
handleNoOrderAdd() {
this.materialDisabled = false;
this.reset();
getOrderCode().then(response => {
this.form.orderCode = response.msg;

Loading…
Cancel
Save