@{
|
ViewBag.Title = "InOrderEdit";
|
Layout = "~/Views/Shared/_LayoutVue.cshtml";
|
}
|
@model TN_WM_WORK_ORDEREntity
|
@section head{
|
<style type="text/css">
|
.el-row {
|
margin-top: 5px;
|
}
|
</style>
|
}
|
<el-container id="inOrderDiv" v-cloak>
|
<el-header height="100%">
|
|
<el-form v-bind:model="formData" v-bind:rules="formRules" ref="formData" label-width="120px" class="demo-ruleForm">
|
<el-row>
|
<el-col v-bind:span="7">
|
<el-form-item label="@HH.WMS.WebUI.LanService.LanServiceDll.translate("cshtml_workorder_manager_work_order_no"):" prop="CN_S_WO_NO">
|
<el-input v-model="formData.CN_S_WO_NO" v-bind:disabled="readOnly" readonly="readonly" required size="mini"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col v-bind:span="7">
|
<el-form-item label="@HH.WMS.WebUI.LanService.LanServiceDll.translate("cshtml_workorder_manager_production_line"):" prop="CN_S_LINE">
|
<hh-select-url v-bind:disabled="readOnly" v-model="formData.CN_S_LINE" url="/Basic/Common/GetDictionary?dictName=生产线"
|
valuefield="NAME"
|
textfield="NAME"></hh-select-url>
|
</el-form-item>
|
</el-col>
|
<el-col v-bind:span="7">
|
<el-form-item label="@HH.WMS.WebUI.LanService.LanServiceDll.translate("cshtml_workorder_manager_production_batch"):" prop="CN_S_PRODUCT_BATCH">
|
<el-input v-model="formData.CN_S_PRODUCT_BATCH" v-bind:disabled="readOnly" size="mini"></el-input>
|
</el-form-item>
|
</el-col>
|
|
<el-col v-bind:span="3">
|
</el-col>
|
</el-row>
|
|
<el-row>
|
<el-col v-bind:span="7">
|
|
<el-form-item label="@HH.WMS.WebUI.LanService.LanServiceDll.translate("cshtml_workorder_manager_item_name"):" prop="CN_S_ITEM_NAME">
|
<el-input v-model="formData.CN_S_ITEM_NAME"
|
readonly="readonly"
|
required
|
v-bind:disabled="readOnly"
|
size="mini">
|
<i slot="suffix" v-on:click="selectItem" class="el-icon-more"></i>
|
</el-input>
|
</el-form-item>
|
</el-col>
|
<el-col v-bind:span="7">
|
<el-form-item label="@HH.WMS.WebUI.LanService.LanServiceDll.translate("cshtml_workorder_manager_item_code"):" prop="CN_S_ITEM_CODE">
|
<el-input v-model="formData.CN_S_ITEM_CODE" readonly="readonly" v-bind:disabled="readOnly" required size="mini"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col v-bind:span="7">
|
<el-form-item label="@HH.WMS.WebUI.LanService.LanServiceDll.translate("cshtml_workorder_manager_item_model"):" prop="CN_S_MODEL">
|
<el-input v-model="formData.CN_S_MODEL" required size="mini" readonly="readonly" v-bind:disabled="readOnly"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col v-bind:span="3">
|
</el-col>
|
</el-row>
|
|
|
<el-row>
|
<el-col v-bind:span="7">
|
<el-form-item label="@HH.WMS.WebUI.LanService.LanServiceDll.translate("cshtml_workorder_manager_item_unit"):" prop="CN_S_UNIT">
|
<el-input v-model="formData.CN_S_UNIT" required size="mini" readonly="readonly" v-bind:disabled="readOnly"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col v-bind:span="7">
|
<el-form-item label="@HH.WMS.WebUI.LanService.LanServiceDll.translate("cshtml_workorder_manager_plan_production_qty"):" prop="CN_F_PLAN_QTY">
|
<el-input v-model="formData.CN_F_PLAN_QTY" v-on:change="checkQty()" required size="mini" v-bind:disabled="readOnly"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col v-bind:span="7">
|
<el-form-item label="@HH.WMS.WebUI.LanService.LanServiceDll.translate("cshtml_workorder_manager_work_order_state"):" prop="CN_S_STATUS">
|
<hh-select-url v-bind:disabled="true" v-model="formData.CN_S_STATUS" url="/Basic/Common/GetDictionary?dictName=工单状态"
|
valuefield="NAME"
|
textfield="NAME"></hh-select-url>
|
</el-form-item>
|
</el-col>
|
<el-col v-bind:span="3">
|
</el-col>
|
</el-row>
|
|
<el-row v-if="displayQty">
|
<el-col v-bind:span="7">
|
<el-form-item label="@HH.WMS.WebUI.LanService.LanServiceDll.translate("cshtml_workorder_manager_actual_product_qty"):" prop="CN_F_REAL_QTY">
|
<el-input v-model="formData.CN_F_REAL_QTY" size="mini" readonly="readonly" v-bind:disabled="readOnly"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col v-bind:span="7">
|
<el-form-item label="@HH.WMS.WebUI.LanService.LanServiceDll.translate("cshtml_workorder_manager_plan_product_tray_number"):" prop="CN_F_PLAN_TRAY_QTY">
|
<el-input v-model="formData.CN_F_PLAN_TRAY_QTY" size="mini" v-bind:disabled="readOnly"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col v-bind:span="7">
|
<el-form-item label="@HH.WMS.WebUI.LanService.LanServiceDll.translate("cshtml_workorder_manager_actual_product_tray_number"):" prop="CN_F_REAL_TRAY_QTY">
|
<el-input v-model="formData.CN_F_REAL_TRAY_QTY" size="mini" v-bind:disabled="readOnly"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col v-bind:span="3">
|
</el-col>
|
</el-row>
|
|
<el-row v-if="displayOverQty">
|
<el-col v-bind:span="7">
|
<el-form-item label="@HH.WMS.WebUI.LanService.LanServiceDll.translate("cshtml_workorder_manager_actual_product_qty"):" prop="CN_F_REAL_QTY">
|
<el-input v-model="formData.CN_F_REAL_QTY" size="mini" readonly="readonly" v-bind:disabled="readOnly"></el-input>
|
</el-form-item>
|
</el-col>
|
<el-col v-bind:span="7">
|
|
</el-col>
|
<el-col v-bind:span="7">
|
|
</el-col>
|
<el-col v-bind:span="7">
|
</el-col>
|
</el-row>
|
<el-row style="margin-bottom:10px;margin-top:10px">
|
<el-col v-bind:span="21">
|
|
<el-form-item label="@HH.WMS.WebUI.LanService.LanServiceDll.translate("cshtml_workorder_manager_work_order_note"):" prop="CN_S_REMARK">
|
<el-input v-model="formData.CN_S_REMARK" v-bind:disabled="readOnly" size="mini" rows="5" type="textarea"></el-input>
|
</el-form-item>
|
</el-col>
|
|
<el-col v-bind:span="3">
|
</el-col>
|
</el-row>
|
|
</el-form>
|
|
</el-header>
|
|
<el-footer style="position: fixed; bottom: 250px; height: 50px; width: 100%">
|
<el-row style="padding:20px;text-align:center">
|
<el-button size="mini" type="primary" v-on:click="save(false)" v-show="!readOnly">@HH.WMS.WebUI.LanService.LanServiceDll.translate("cshtml_public_button_save")</el-button>
|
<el-button size="mini" type="warning" v-on:click="submit" v-show="!readOnly">@HH.WMS.WebUI.LanService.LanServiceDll.translate("cshtml_public_button_excute")</el-button>
|
<el-button size="mini" v-on:click="cancel">@HH.WMS.WebUI.LanService.LanServiceDll.translate("cshtml_public_button_close")</el-button>
|
</el-row>
|
</el-footer>
|
|
</el-container>
|
@section scripts{
|
<script>
|
$(function () {
|
|
});
|
new Vue({
|
el: '#inOrderDiv',
|
mixins: [useAutoHeight, wmsApps],
|
computed: {
|
tableHeight: function () {
|
return this.autoHeight - 210;
|
}
|
},
|
data: {
|
itemTable: {
|
show: false,
|
top: 0,
|
left: 0
|
},
|
where: {},
|
readOnly: false,
|
displayQty: false,
|
displayOverQty: false,
|
formData: {
|
CN_S_WO_NO: "@Model.CN_S_WO_NO",
|
CN_S_LINE: "@Model.CN_S_LINE",
|
CN_S_ITEM_CODE: "@Model.CN_S_ITEM_CODE",
|
CN_S_ITEM_NAME: "@Model.CN_S_ITEM_NAME",
|
CN_S_MODEL: "@Model.CN_S_MODEL",
|
CN_S_PRODUCT_BATCH: "@Model.CN_S_PRODUCT_BATCH",
|
CN_F_PLAN_QTY: "@Math.Round(Model.CN_F_PLAN_QTY, 2).ToString()",
|
CN_F_REAL_QTY: "@Math.Round(Model.CN_F_REAL_QTY, 2).ToString()",
|
CN_F_PLAN_TRAY_QTY: "@Math.Round(Model.CN_F_PLAN_TRAY_QTY, 2).ToString()",
|
CN_F_REAL_TRAY_QTY: "@Math.Round(Model.CN_F_REAL_TRAY_QTY, 2).ToString()",
|
CN_S_STATUS: "@Model.CN_S_STATUS",
|
CN_S_UNIT: "@Model.CN_S_UNIT",
|
CN_T_CREATE: "@Model.CN_T_CREATE",
|
CN_S_REMARK: "@Model.CN_S_REMARK",
|
OperateType: "@Model.OperateType",
|
OperateMessage: ""
|
},
|
formRules: {
|
CN_S_WO_NO: [
|
{ required: true, message: ' ', trigger: 'blur' }
|
],
|
CN_S_LINE: [
|
{ required: true, message: ' ', trigger: 'change' }
|
],
|
CN_S_PRODUCT_BATCH: [
|
{ required: true, message: ' ', trigger: 'change' }
|
],
|
CN_F_PLAN_QTY: [
|
{ required: true, message: ' ', trigger: 'change' }
|
],
|
CN_S_ITEM_CODE: [
|
{ required: true, message: ' ', trigger: 'change' }
|
],
|
CN_S_ITEM_NAME: [
|
{ required: true, message: ' ', trigger: 'change' }
|
],
|
CN_S_STATUS: [
|
{ required: true, message: ' ', trigger: 'change' }
|
]
|
},
|
itemCols: [
|
{ f: 'CN_S_ITEM_CODE', n: '物料编码' },
|
{ f: 'CN_S_ITEM_NAME', n: '物料名称' },
|
{ f: 'CN_S_MODEL', n: '规格型号' },
|
{ f: 'CN_S_MEASURE_UNIT', n: '计量单位' }
|
],
|
|
//父页面选择的物料数据
|
selections: [],
|
currentTitle: wms.currentTitle,
|
emptyValue: '',
|
itemData: [],
|
hasEdit: false
|
},
|
watch: {
|
formData: {
|
deep: true,
|
handler: function (val) {
|
console.log('edit');
|
this.hasEdit = true;
|
}
|
}
|
},
|
methods: {
|
checkQty: function () {
|
var $this = this;
|
var planQty = $this.formData.CN_F_PLAN_QTY;
|
var qty = planQty + "";
|
if (planQty > 9999) {
|
qty = qty.substring(0, 4);
|
}
|
else {
|
qty = qty.replace(/[^\d.]/g, "");//先把非数字的都替换掉,除了数字和.
|
qty = qty.replace(/\.{2,}/g, ".");//保证只有出现一个.而没有多个.
|
qty = qty.replace(/^\./g, ""); //必须保证第一个为数字而不是.
|
qty = qty.replace(".", "$#$").replace(/\./g, "").replace("$#$", ".");//保证.只出现一次,而不能出现两次以上
|
qty = qty.replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3'); //只能输入两个小数
|
}
|
|
$this.formData.CN_F_PLAN_QTY = qty;
|
|
},
|
cancel: function () {
|
var $this = this;
|
//if (!this.readOnly && this.hasEdit) {
|
// wms.confirm("是否保存?", function () {
|
// if ($this.save(false))
|
// parent.tab.tabDeleteRefresh($this.currentTitle, GetUrlParam("mainPage"));
|
// }, function () {
|
// parent.tab.tabDeleteRefresh($this.currentTitle, GetUrlParam("mainPage"));
|
// });
|
//} else {
|
parent.tab.tabDeleteRefresh($this.currentTitle, GetUrlParam("mainPage"));
|
//}
|
},
|
selectItem: function () {
|
if (this.readOnly) return;
|
var $this = this;
|
wms.showDialogList({
|
title: '选择物料',
|
show: true,
|
condition: 'item',
|
itemCols: $this.itemCols,
|
url: '/Basic/Common/ItemList',
|
single: true,
|
btnSure: function (checkedItem) {
|
$this.formData.CN_S_ITEM_CODE = checkedItem[0].CN_S_ITEM_CODE;
|
$this.formData.CN_S_ITEM_NAME = checkedItem[0].CN_S_ITEM_NAME;
|
$this.formData.CN_S_MODEL = checkedItem[0].CN_S_MODEL;
|
$this.formData.CN_S_UNIT = checkedItem[0].CN_S_MEASURE_UNIT;
|
}
|
});
|
},
|
//提交
|
submit: function () {
|
var $this = this;
|
|
if ($this.formData.CN_S_STATUS == "执行中") {
|
wms.warning("此单据已是执行中,请勿重复执行!");
|
return false;
|
}
|
if ($this.formData.OperateType == "@HH.WMS.Entitys.Common.OperateType.Edit") {
|
wms.confirm("确认执行生产?", function () {
|
$this.save(true);
|
});
|
} else {
|
wms.warning("请先保存单据再执行!");
|
}
|
},
|
save: function (isSubmit) {
|
var $this = this;
|
if (!isSubmit) {
|
if ($this.formData.CN_S_STATUS == "执行中") {
|
wms.warning("此单据已是执行中,请勿保存!");
|
return false;
|
}
|
}
|
|
this.$refs["formData"].validate(function (valid) {
|
if (valid) {
|
if (parseFloat($this.formData.CN_F_PLAN_QTY) == 0) {
|
wms.warning("计划生产数量无效!");
|
return false;
|
}
|
console.log($this.tableData);
|
$this.formData.DTLEntity = $this.tableData;
|
var successMsg = "保存成功!";
|
$this.formData.OperateMessage = "";
|
if (isSubmit) {
|
$this.formData.OperateMessage = "@HH.WMS.Common.Constants.Operate_EditAndSubmit";
|
successMsg = "执行成功!";
|
}
|
//保存数据
|
ajaxManage({
|
url: "@Url.Action("SaveInOrder")",
|
data: JSON.stringify($this.formData),
|
traditional: true,
|
success: function (data) {
|
wms.showMsg(data, function () {
|
wms.success(successMsg);
|
$this.formData.OperateType = "@HH.WMS.Entitys.Common.OperateType.Edit";
|
$this.hasEdit = false;
|
if (isSubmit) {
|
$this.formData.CN_S_STATUS = "执行中";
|
parent.tab.tabDeleteRefresh($this.currentTitle, GetUrlParam("mainPage"));
|
}
|
|
}, function () {
|
|
});
|
}
|
});
|
|
} else {
|
wms.warning("验证不通过");
|
return false;
|
}
|
});
|
return true;
|
}
|
},
|
mounted: function () {
|
var $this = this;
|
if ($this.formData.OperateType == "@HH.WMS.Entitys.Common.OperateType.Read") {
|
$this.readOnly = true;
|
}
|
else {
|
$this.hasEdit = false;
|
}
|
|
if ($this.formData.CN_S_STATUS == "执行中") {
|
$this.displayQty = true;
|
}
|
if ($this.formData.CN_S_STATUS == "完成" || $this.formData.CN_S_STATUS == "强制完成") {
|
$this.displayOverQty = true;
|
}
|
}
|
});
|
</script>
|
}
|