| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484 |
- @using IwbZero.AppServiceBase
- @using ShwasherSys.Authorization.Permissions
- @using ShwasherSys.Models.Layout
- @using ShwasherSys.Models.Modal
- @{
- /**/
- ViewBag.ActiveMenu = PermissionNames.PagesProductionInfoProductionOutStoreApplyMg; //The menu item will be active for this page.
- ViewBag.Title = "外协加工出库申请";
- List<SelectListItem> processTypeItems = ViewBag.ProcessTypeItems;
- List<SelectListItem> applyStatus = ViewBag.ApplyStatus;
- List<SelectListItem> storeHouses = ViewBag.StoreHouses;
- List<SelectListItem> closeStatus = new List<SelectListItem>()
- {
- new SelectListItem(){Text = @"未关闭",Value = "false",Selected = true},
- new SelectListItem(){Text = @"已关闭",Value = "true"}
- };
- var searchForm = new SearchFormViewModal(new List<SearchItem>()
- {
- new SearchItem("productionOrderNo","排产单号"),
- new SearchItem("semiProductNo","半成品编码").SetSearchIcon("query_semiProduct_modal"),
- new SearchItem("applyStatus","申请状态" )
- .SetSearchItem(applyStatus),
- new SearchItem("isClose","关闭状态" ,FiledType.Bnull,ExpType.Equal)
- .SetSearchItem(closeStatus)
- }, false);
- }
- @section css{
- <link href="~/Content/Plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css" rel="stylesheet" />
- }
- <section style="display: none">
- @Html.DropDownList("hide-ApplyStatus", applyStatus)
- @Html.DropDownList("hide-StoreHouses", storeHouses)
- </section>
- <div class="table-box mr-4 iwb-bootstrap-table">
- @Html.Action("ToolMenu", "Layout", new { pageName = ViewBag.ActiveMenu, searchForm })
- <table id="table"
- data-url="/api/services/app/ProductionOrders/GetSemiOutStoreApply"
- data-striped="true" data-id-field="id" data-unique-id="id"
- data-method="post"
- data-side-pagination="server"
- data-content-type="application/x-www-form-urlencoded; charset=UTF-8"
- data-cache="false"
- data-pagination="true" data-page-size="30" data-page-number="1" data-page-list="[30,50,100,200]" data-pagination-detail-h-align="right" data-pagination-h-align="left"
- data-query-params="QueryParams"
- data-response-handler="ResponseHandler"
- data-click-to-select="true"
- data-single-select="true">
- <thead>
- <tr class="row" id="header">
- <th data-field="state" data-checkbox="true"></th>
- <th data-align="center" data-field="productionOrderNo">排产单号</th>
- <th data-align="center" data-field="semiProductNo">半成品编码</th>
- <th data-align="center" data-field="semiProductName">半成品名称</th>
- <th data-align="center" data-field="quantity">申请出库数量(kg)</th>
- <th data-align="center" data-field="actualQuantity">出库数量(kg)</th>
- <th data-align="center" data-field="storeHouseId" data-formatter="StoreHouseIdFormatte">仓库</th>
- <th data-align="center" data-field="applyStatus" data-formatter="ApplyStatusFormatter">申请状态</th>
- <th data-align="center" data-field="applyOutDate">申请时间</th>
- <th data-align="center" data-field="surfaceColor">表色</th>
- <th data-align="center" data-field="model">规格</th>
- <th data-align="center" data-field="rigidity">硬度</th>
- <th data-align="center" data-field="material">材质</th>
- <th data-align="center" data-field="partNo">零件号</th>
- <th data-align="center" data-field="remark">备注</th>
- <th data-align="center" data-formatter="ActionFormatter">操作</th>
- </tr>
- </thead>
- </table>
- </div>
- @section modal{
- <section>
- <!--Main Modal-->
- <div class="modal fade" id="modal" role="dialog" tabindex="-1" aria-labelledby="ModalLabel" aria-hidden="true">
- <div class="modal-dialog modal-dialog-centered" role="document">
- <div class="modal-content">
- @Html.Partial("Modals/_ModalHeader", new ModalHeaderViewModel("出库申请"))
- @{
- var inputs = new List<InputViewModel>
- {
- new InputViewModel("id", hide:true),
- new InputViewModel("maxQuantity", hide:true),
- new InputViewModel("productionOrderNo",displayName:"源流转单号").SetSearchIcon("query_semiCurrentStore_modal"),
- new InputViewModel("currentSemiStoreHouseNo", hide:true),
- new InputViewModel("semiProductNo", displayName:"半成品编码"),
- new InputViewModel("quantity", displayName:"申请数量",@class:"number",other:"min=0.001"),
- new InputViewModel("remark",InputTypes.Textarea,displayName:"备注").SetNotRequired(),
- //new InputViewModel("surfaceColor", displayName: "表色").SetNotRequired(),
- //new InputViewModel("model", displayName: "规格").SetNotRequired(),
- //new InputViewModel("rigidity", displayName: "硬度").SetNotRequired(),
- //new InputViewModel("material", displayName: "材质").SetNotRequired(),
- //new InputViewModel("kgWeight", displayName: "千件重").SetNotRequired(),
- new InputViewModel("applyStatus",hide:true),
- new InputViewModel("applyOutStoreSource",hide:true),
- new InputViewModel("canUserQuantity",hide:true),
- new InputViewModel("storeHouseId",hide:true),
- };
- //var specials = new List<SpecialInputModel>();
- }
- @Html.Partial("Modals/_ModalBody", new ModalBodyViewModel(inputs))
- @Html.Partial("Modals/_ModalFooter", "0")
- </div>
- </div>
- </div>
- </section>
- @{
- List<MultiSearchDto> searchListDto = new List<MultiSearchDto>();
- searchListDto.Add(new MultiSearchDto()
- {
- ExpType = 1,
- FieldType = 1,
- KeyWords = "4",
- KeyField = "StoreHouseId"
- });
- }
- @Html.Partial("Modals/Query/_SemiCurrentStoreEx", new QueryParamModel(targetDom: "6:quantity|maxQuantity", searchList: searchListDto))
- <section>
- <!--CreateProductionOrder Modal-->
- <div class="modal fade" id="modalCreateProductionOrder" role="dialog" tabindex="-1" aria-labelledby="ModalLabel" aria-hidden="true">
- <div class="modal-dialog modal-dialog-centered" role="document">
- <div class="modal-content">
- @Html.Partial("Modals/_ModalHeader", new ModalHeaderViewModel("确认收货并创建外协流转单", ""))
- @{
- var inputs2 = new List<InputViewModel>
- {
- new InputViewModel("outStoreId",hide:true),
- new InputViewModel("outsourcingFactory",hide:true),
- new InputViewModel("sourceProductionOrderNo",displayName:"源流转单号").SetDisabled(),
- new InputViewModel("processingType",InputTypes.List,displayName:"加工类别").SetSelectOptions(processTypeItems),
- new InputViewModel("outsourcingFactoryName",displayName:"外协厂商").SetSearchIcon("query_outFactory_modal"),
- new InputViewModel("processingTypeNo",displayName:"外协编码",@class:"outCode" ),
- new InputViewModel("planProduceDate",displayName:"计划完成日期" ),
- new InputViewModel("eaCurrentSemiStoreHouseNo", hide:true),
- //new InputViewModel("eaSemiProductNo", displayName:"半成品编码").SetDisabled().SetInterBefore(" <div class=\"input-group\">").SetInterAfter("<div class=\"input-group-addon\" style=\"padding: 1px 12px\" onclick=\"showSelectSemiProductDialog()\" > <i class=\"iconfont icon-search\"></i></div></div>"),
- new InputViewModel("eaSemiProductNo", displayName:"半成品编码").SetSearchIcon("query_semiProductEx_modal"),
- new InputViewModel("eaQuantity", displayName:"加工数量",@class:"number",other:"min=0.001"),
- new InputViewModel("remark",InputTypes.Textarea,displayName:"备注").SetNotRequired(),
- new InputViewModel("semiProductName", displayName:"半成品名称").SetDisabled(),
- new InputViewModel("model", displayName:"规格").SetDisabled(),
- new InputViewModel("material", displayName:"材质").SetDisabled(),
- new InputViewModel("rigidity", displayName:"硬度").SetDisabled(),
- new InputViewModel("surfaceColor", displayName:"表色").SetDisabled(),
- };
- //var specials = new List<SpecialInputModel>();
- }
- @Html.Partial("Modals/_ModalBody", new ModalBodyViewModel(inputs2, "CreateProductionOrderForm"))
- @Html.Partial("Modals/_SwModalFooter", new ModelFooterModel("modalCreateProductionOrder", "Submitcreateorder()"))
- </div>
- </div>
- </div>
- </section>
- @Html.Partial("Modals/Query/_SemiProduct", "KeyWords-2")
- @Html.Partial("Modals/Query/_SemiProductEx", "eaSemiProductNo")
- @Html.Partial("Modals/Query/_OutFactory", "outsourcingFactory,outsourcingFactoryName")
- }
- @section scripts
- {
- <script src="~/Content/Plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
- <script src="~/Content/Plugins/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
- <script type="text/javascript">
- // 外协编码验证
- jQuery.validator.addMethod("outCode", function (value, element) {
- //var tel = /^[a-zA-Z0-9]{2}$/;
- var tel = /^[0-9]{2}$/;
- return this.optional(element) || (tel.test(value));
- }, "外协编码为两位数字");
- var datePickerOpt = {
- language: 'zh-CN',
- format: "yyyy-mm-dd",
- todayBtn: true,
- autoclose: true,
- startView: 2,
- minView: 2,
- maxView: 4
- //showSecond: true,
- //showHours: true,
- //minuteStep: 10
- };
- $(function () {
- $("#planProduceDate").datetimepicker(datePickerOpt).on('show',
- function (event) {
- event.preventDefault();
- event.stopPropagation();
- }).on('hide',
- function (event) {
- event.preventDefault();
- event.stopPropagation();
- });
- $("#KeyWords-4").val("false").select2();
- LoadTable();
- var funs = window.funs || { none: function () { console.log("No type"); } };
- //funs["btnUpdate"] = function () {
- // var rows = config.table.bootstrapTable("getSelections");
- // if (rows.length === 1) {
- // if (rows[0].applyStatus === "2") {
- // abp.message.warn("申请单已处理,不能进行修改!");
- // return;
- // }
- // if (rows[0].applyStatus === "5" ) {
- // abp.message.warn("申请单已出库,不能进行修改!");
- // return;
- // }
- // BtnUpdate({ readonly: "id,productionOrderNo,semiProductNo,model,surfaceColor,rigidity,material,kgWeight" });
- // } else
- // abp.message.warn(abp.localization.localize("ChooseOneToOp"));
- //};
- //funs["btnCreate"] = function () { BtnCreate({
- // readonly: "id,productionOrderNo,semiProductNo,model,surfaceColor,rigidity,material,kgWeight",
- // data: { applyStatus: "1", applyOutStoreSource: "1", storeHouseId: "2" }
- // });
- //};
- funs["btnCreate"] = function (url) {
- BtnCreate({
- readonly: "id,productionOrderNo,semiProductNo,model,surfaceColor,rigidity,material,kgWeight",
- data: { applyStatus: "1", applyOutStoreSource: "1", storeHouseId: "2" },
- save: function() {
- var q = Number($("#quantity").val());
- if ( q<= 0) {
- abp.message.warn("出库数量必须大于0!");
- return;
- } else if (q >Number($("#maxQuantity").val())) {
- abp.message.warn("出库数量必须小于可用库存(" + $("#maxQuantity").val() + ")!");
- return;
- }
- SaveAjax({
- url: url,
- form: $('#form'),
- success: function(res) {
- abp.message.success(abp.localization.localize("OpSuccess")).done(function() {
- f_createProductionOrder(res.id);
- });
- RefreshTable();
- }
- });
- }
-
- });
- };
- funs["btnQueryStore"] = function () {
- ShowModal("query_semiCurrentStore_modal");
- };
- });
- function f_cancelApply(id, status) {
- console.log("cancelApply", id);
- abp.message.confirm("确认取消申请?",
- "取消申请",
- function () {
- abp.ajax({
- url: window.appUrl + 'ProductionOrders/CancelSemiOutStoreApplyStatus',
- data: { Id: id, ProductionOrderStatus: status },
- async: true,
- type: "Post",
- contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
- isValidate: false,
- dataType: "json",
- success: function () {
- abp.message.success(abp.localization.localize("OpSuccess"));
- RefreshTable();
- }
- });
- });
- }
- function f_recoveryApply(id) {
- console.log("recoveryApply", id);
- abp.message.confirm("确认恢复申请?",
- "恢复申请",
- function () {
- abp.ajax({
- url: window.appUrl + 'ProductionOrders/RecoverySemiOutStoreApplyStatus',
- data: { Id: id, ProductionOrderStatus: status },
- async: true,
- type: "Post",
- contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
- isValidate: false,
- dataType: "json",
- success: function () {
- abp.message.success(abp.localization.localize("OpSuccess"));
- RefreshTable();
- }
- });
- });
- }
- function f_closeApply(id) {
- console.log("recoveryApply", id);
- abp.message.confirm("出库申请关闭后不可恢复,确认关闭申请?",
- "关闭申请",
- function () {
- abp.ajax({
- url: window.appUrl + 'ProductionOrders/CloseOutStoreApply',
- data: { Id: id },
- async: true,
- type: "Post",
- contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
- isValidate: false,
- dataType: "json",
- success: function () {
- abp.message.success(abp.localization.localize("OpSuccess"));
- RefreshTable();
- }
- });
- });
- }
- function f_createProductionOrder(id) {
- SaveAjax({
- url: window.appUrl + "ProductionOrders/GetSemiOutStoreApplyById?id=" + id,
- isAlert: false,
- isValidate: false,
- success: function (row) {
- $("#outStoreId").val(row.id);
- $("#sourceProductionOrderNo").val(row.productionOrderNo);
- /*$("#processingType").val(row.productionOrderNo);*/
- $("#processingTypeNo").val("");
- $("#eaCurrentSemiStoreHouseNo").val(row.currentSemiStoreHouseNo);
- $("#eaSemiProductNo").val(row.semiProductNo);
- $("#eaQuantity").val(row.actualQuantity).prop("disabled",true);
- $("#model").val(row.model);
- $("#material").val(row.material);
- $("#rigidity").val(row.rigidity);
- $("#surfaceColor").val(row.surfaceColor);
- queryParams.model = row.model;
- queryParams.modelExpType = '6';
- queryParams.material = row.material;
- queryParams.materialExpType = '6';
- queryParams.semiProductName = row.semiProductName;
- queryParams.semiProductNameExpType = '6';
- $("#modalCreateProductionOrder").modal("show");
- }
- });
- }
- function f_confirmOutApply(id) {
- console.log("cancelApply", id);
- abp.message.confirm("确认产品出库数量正确吗?",
- "确认出库数量",
- function () {
- abp.ajax({
- url: window.appUrl + 'ProductionOrders/ConfirmSemiOutStoreQuantity',
- data: { Id: id },
- async: true,
- type: "Post",
- contentType: 'application/x-www-form-urlencoded; charset=UTF-8',
- isValidate: false,
- dataType: "json",
- success: function () {
- abp.message.success(abp.localization.localize("OpSuccess")).done(function() {
- f_createProductionOrder(id);
- });
- RefreshTable();
- }
- });
- });
- }
- function Submitcreateorder() {
-
- SaveAjax({
- url: window.appUrl + "ProductionOrders/CreateOutProductionOrder",
- data: { OutStoreId: $("#outStoreId").val(), sourceProductionOrderNo: $("#sourceProductionOrderNo").val(), processingTypeNo: $("#processingTypeNo").val(), outsourcingFactory: $("#outsourcingFactory").val(), processingType: $("#processingType").val(), Quantity: $("#eaQuantity").val(), SemiProductNo: $("#eaSemiProductNo").val(),planProduceDate:$("#planProduceDate").val(),Remark:$('#modalCreateProductionOrder #remark').val() },
- modal:$("#modalCreateProductionOrder"),
- isAlert: false,
- success: function (res) {
- if (res) {
- abp.message.success("外协流转单创建成功,前往外协生产维护中查看信息!").done(function() {
- window.location.href = "@Url.Action("OutProductionOrderMg","ProductionInfo")";
- });
- $("#modalCreateProductionOrder").modal("hide");
- RefreshTable();
- }
- }
- });
- }
- function Submit_query_semiProductEx_modal(row) {
- row = row || $query_semiProductEx_modal_table.bootstrapTable("getSelections")[0];
- row = CheckIsExistAndGetNewProduct(row.id);
- if (row) {
- $(targetDom + ' #eaSemiProductNo').val(row.id);
- $(targetDom + " #semiProductName").val(row.productName);
- $(targetDom + " #model").val(row.model);
- $(targetDom + " #material").val(row.material);
- $(targetDom + " #surfaceColor").val(row.surfaceColor);
- $(targetDom + " #rigidity").val(row.rigidity);
- $("#query_semiProductEx_modal").modal('hide');
- }
- }
- function CheckIsExistAndGetNewProduct(productNo) {
- let row;
- SaveAjax({
- url: window.appUrl + 'Common/GetNewSemiProductInfo?productNo=' + productNo,
- isValidate: false,
- isAlert: false,
- async: false,
- success: function (res) {
- if (res) {
- let pNo = res.id;
- let reg = new RegExp(/^s.{13}/g);
- if (productNo !== pNo && reg.test(pNo)) {
- abp.message.warn(`此产品已被弃用,系统自动更换新产品!`);
- }
- row = res;
-
- }
- }
- });
- return row;
- }
- </script>
- <script id="formatter">
- function StoreHouseIdFormatte(v) {
- var name = $("#hide-StoreHouses option[value='" + v + "']").text();
- return '<span class="label label-primary">' + name + '</span>';
- }
- function ApplyStatusFormatter(v, r) {
- if (r.isClose) {
- return '<span class="label label-primary">已结束</span>';
- }
- var name = $("#hide-ApplyStatus option[value='" + v + "']").text();
- if (v === "1") {
- return '<span class="label label-default">' + name + '</span>';
- } else if (v === "2") {
- return '<span class="label label-success">' + name + '</span>';
- } else if (v === "3") {
- return '<span class="label label-warning">' + name + '</span>';
- } else if (v === "4") {
- return '<span class="label label-danger">' + name + '</span>';
- }
- return '<span class="label label-info">' + name + '</span>';
- }
- function ActionFormatter(v, r) {
- var str = '<span class="table-action">暂无操作</span>';;
- if (r.isConfirm && !r.isClose) {
- str = '<span class="table-action" onclick="f_createProductionOrder(\'' +
- r.id +
- '\')"><i class="iconfont icon-right"></i>创建流转单</span>';
- }
- //else {
- // if (r.applyStatus === "1") {
- // str = '<span class="table-action" onclick="f_cancelApply(\'' +
- // r.id +
- // '\',3)"><i class="iconfont icon-right"></i>取消申请</span>';
- // } else if (r.applyStatus === "2") {
- // str = '<span class="table-action" onclick="f_confirmOutApply(\'' +
- // r.id +
- // '\')"><i class="iconfont icon-right"></i>确认收货</span>';
- // } else if (r.applyStatus === "3" || r.applyStatus === "4") {
- // str = '<span class="table-action" onclick="f_recoveryApply(\'' + r.id +
- // '\')"><i class="iconfont icon-right"></i>恢复申请</span><span class="table-action" onclick="f_closeApply(\'' + r.id +
- // '\')"><i class="iconfont icon-right"></i>关闭申请</span>';
- // } else {
- // str = '<span class="table-action">暂无操作</span>';
- // }
- //}
- return str;
- }
- </script>
- }
|