diff --git a/NX.ERP.Model/Request/Arrival.cs b/NX.ERP.Model/Request/Arrival.cs index 2002459..e51a11e 100644 --- a/NX.ERP.Model/Request/Arrival.cs +++ b/NX.ERP.Model/Request/Arrival.cs @@ -7,6 +7,13 @@ namespace NX.ERP.Model.Request { public class Arrival:BaseModel { + + + public List ArrivalNolist { get; set; } + + public string ArrivalNo { get; set; } + + public string cInvCode { get; set; } } } diff --git a/NX.ERP.Model/Response/Purchase/Arrival.cs b/NX.ERP.Model/Response/Purchase/Arrival.cs index f7c4801..a0a6ba1 100644 --- a/NX.ERP.Model/Response/Purchase/Arrival.cs +++ b/NX.ERP.Model/Response/Purchase/Arrival.cs @@ -23,6 +23,8 @@ namespace NX.ERP.Model.Purchase public string PreparedBy { get; set; } + + public string SupplierCode { get => supplierCode; set => supplierCode = value; } public double ExchRate { get; set; } public string ExchName { get; set; } diff --git a/NX.ERP.Model/Response/Purchase/ArrivalDetail.cs b/NX.ERP.Model/Response/Purchase/ArrivalDetail.cs index 8142930..e4c4014 100644 --- a/NX.ERP.Model/Response/Purchase/ArrivalDetail.cs +++ b/NX.ERP.Model/Response/Purchase/ArrivalDetail.cs @@ -19,6 +19,7 @@ namespace NX.ERP.Model.Purchase public string UnitCode { get => unitCode; set => unitCode = value; } public double Qty { get => quantity; set => quantity = value; } public double RealQuantity { get; set; } + public string cPosName { get; set; } /// /// 审批状态2 说明已经审核过了 /// diff --git a/NX.ERP.U8.App/FrmMain.cs b/NX.ERP.U8.App/FrmMain.cs index 400f054..6754a2c 100644 --- a/NX.ERP.U8.App/FrmMain.cs +++ b/NX.ERP.U8.App/FrmMain.cs @@ -207,9 +207,10 @@ namespace U8AppMain body.inventorycode = row["存货编码"].ToString().Trim(); body.taxrate = InvInfo[body.inventorycode].TaxRate; - body.requiredate = purchase.purchaseapp.header.date; + // body.requiredate = purchase.purchaseapp.header.date; body.define25 = row["用料工位"].ToString().Trim(); body.quantity = decimal.Parse(row["数量"].ToString()); + body.requiredate = row["需求日期"].ToString().Trim(); purchase.purchaseapp.body.Add(body); } } diff --git a/NX.ERP.U8/NX.ERP.U8.csproj b/NX.ERP.U8/NX.ERP.U8.csproj index 76ebdc9..f8d456e 100644 --- a/NX.ERP.U8/NX.ERP.U8.csproj +++ b/NX.ERP.U8/NX.ERP.U8.csproj @@ -48,6 +48,7 @@ + diff --git a/NX.ERP.U8/Pmc/WarehouseQuery.cs b/NX.ERP.U8/Pmc/WarehouseQuery.cs new file mode 100644 index 0000000..4236612 --- /dev/null +++ b/NX.ERP.U8/Pmc/WarehouseQuery.cs @@ -0,0 +1,85 @@ +using NX.ERP.U8.Purchase; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using Dapper; + + +namespace NX.ERP.U8.Finance + +{ + public class WarehouseQuery + { + /// + /// + /// + /// + /// + /// + + + public IEnumerable ArrivalGet(NX.ERP.Model.Request.Arrival arrival) + { + string sql = @"select a.id AS ArrivalId,a.cCode as ArrivalCode,a.cpersoncode,a.cpersonname,A.cbustype AS busType,a.cptcode as PTCode,a.iTaxRate as TaxRate,a.iexchrate as Exchrate,cexch_name as ExchName,cVenCode as VenCode,CONVERT(varchar(100), a.dDate, 23) as ArrivalDate,A.cVenCode AS SupplierCode, + B.Autoid as id,b.ID as ArrivalID,b.cinvname,b.cinvstd, + b.cInvCode AS MaterialCode, + b.cBatch AS BatchNo, + b.fvalidinquan as RealQuantity, + b.ccomunitcode AS UnitCode,b.ioricost as oricost,b.ioritaxcost as oritaxcost ,b.icost as cost,b.iorimoney as orimoney,b.ioritaxprice as oritaxprice,b.iorisum as orisum,b.isum as sum, + B.iQuantity as Quantity,b.iposid as PosId ,B.CORDERCODE as OrderCode,C.POID as Poid,b.iNum,b.ccomunitcode,b.cunitid,b.cinva_unit,b.cinvm_unit,b.inspecexchrate, + Pos.cPosName + FROM pu_ArrBody b WITH (NOLOCK) inner join pu_ArrHead a WITH (NOLOCK) on a.id=b.id + inner join (select cinvcode as cinvcode1,iId from inventory WITH (NOLOCK)) inventory on b.cinvcode=inventory.cinvcode1 + Left Join PO_Podetails C WITH (NOLOCK) ON B.iPOsID = C.ID , + (SELECT cinvcode, + STUFF( + ( + SELECT ','+ cPosName FROM ( select b.cPosName,a.cInvCode,a.iQuantity from InvPositionSum a WITH (NOLOCK) left join Position b WITH (NOLOCK) on a.cPosCode=b.cPosCode + where a.iQuantity <>0) a WHERE b.cinvcode = a.cinvcode order by a.iQuantity desc FOR XML PATH('') + ),1 ,1, '') cPosName + FROM InvPositionSum b + GROUP BY cinvcode + ) Pos -- on isnull (b.cInvCode,'')=isnull(Pos.cInvCode,'') + + Where ( (1>0) AND (1>0) ) AND ( 1>0 ) and (isnull(cbustype,'')<>'委外加工') and isnull (b.cInvCode,'')=isnull(Pos.cInvCode,'') + And (1=1) and isnull(b.cbcloser,N'')=N'' And isnull(a.cverifier,'')<>'' + And a.iBillType =N'0' and isnull(b.bGsp,N'')=N'0' and (isnull(b.iQuantity,0)-isnull(b.fRefuseQuantity,0)>isnull(b.fValidInQuan,0) or (b.igrouptype=2 + and isnull(b.inum,0)-isnull(b.frefusenum,0)>isnull(b.fvalidinnum,0))) and isnull(a.bStorageArrivalOrder,1)=1 and 1=1 + + + +"; + + List where = new List(); + + //处理- + if (!string.IsNullOrEmpty(arrival.cInvCode)) + { + where.Add(" b.cinvcode = @cinvcode"); + } + if (arrival.ArrivalNolist != null && arrival.ArrivalNolist.Count > 0) + { + where.Add(" a.cCode in @cCodelist"); + } + if (!string.IsNullOrEmpty(arrival.ArrivalNo)) + { + where.Add(" a.cCode = @cCode"); + } + + var aa = string.Join(" and ", where.ToArray()); + + if (!string.IsNullOrEmpty(aa)) + { + sql += " and " + aa; + } + + using (var conn = NX.ERP.U8.U8LoginContext.Instance.Connection) + { + return conn.Query(sql, new { cCodelist = arrival.ArrivalNolist, cinvcode = arrival.cInvCode, cCode = arrival.ArrivalNo }); + } + } + + + } +} diff --git a/NX.ERP.U8/Purchase/ArrivalDAL.cs b/NX.ERP.U8/Purchase/ArrivalDAL.cs index 0c5be8d..30d58b9 100644 --- a/NX.ERP.U8/Purchase/ArrivalDAL.cs +++ b/NX.ERP.U8/Purchase/ArrivalDAL.cs @@ -7,7 +7,7 @@ namespace NX.ERP.U8.Purchase { public class ArrivalDAL { - public IEnumerable GetList(string strWhere = "", object param = null) + public IEnumerable GetList(List strWhere , object param = null) { using (var conn = U8LoginContext.Instance.Connection) { @@ -17,18 +17,35 @@ namespace NX.ERP.U8.Purchase b.cBatch AS BatchNo, b.fvalidinquan as RealQuantity, b.ccomunitcode AS UnitCode,b.ioricost as oricost,b.ioritaxcost as oritaxcost ,b.icost as cost,b.iorimoney as orimoney,b.ioritaxprice as oritaxprice,b.iorisum as orisum,b.isum as sum, - B.iQuantity as Quantity,b.iposid as PosId ,B.CORDERCODE as OrderCode,C.POID as Poid,b.iNum,b.ccomunitcode,b.cunitid,b.cinva_unit,b.cinvm_unit,b.inspecexchrate + B.iQuantity as Quantity,b.iposid as PosId ,B.CORDERCODE as OrderCode,C.POID as Poid,b.iNum,b.ccomunitcode,b.cunitid,b.cinva_unit,b.cinvm_unit,b.inspecexchrate, + Pos.cPosName FROM pu_ArrBody b inner join pu_ArrHead a on a.id=b.id inner join (select cinvcode as cinvcode1,iId from inventory) inventory on b.cinvcode=inventory.cinvcode1 - Left Join PO_Podetails C WITH (NOLOCK) ON B.iPOsID = C.ID - Where ( (1>0) AND (1>0) ) AND ( 1>0 ) and (isnull(cbustype,'')<>'委外加工') + Left Join PO_Podetails C WITH (NOLOCK) ON B.iPOsID = C.ID , + (SELECT cinvcode, + STUFF( + ( + SELECT ','+ cPosName FROM ( select b.cPosName,a.cInvCode,a.iQuantity from InvPositionSum a WITH (NOLOCK) left join Position b WITH (NOLOCK) on a.cPosCode=b.cPosCode + where a.iQuantity <>0) a WHERE b.cinvcode = a.cinvcode order by a.iQuantity desc FOR XML PATH('') + ),1 ,1, '') cPosName + FROM InvPositionSum b + GROUP BY cinvcode + ) Pos -- on isnull (b.cInvCode,'')=isnull(Pos.cInvCode,'') + Where ( (1>0) AND (1>0) ) AND ( 1>0 ) and (isnull(cbustype,'')<>'委外加工') and isnull (b.cInvCode,'')=isnull(Pos.cInvCode,'') And (1=1) and isnull(b.cbcloser,N'')=N'' And isnull(a.cverifier,'')<>'' And a.iBillType =N'0' and isnull(b.bGsp,N'')=N'0' and (isnull(b.iQuantity,0)-isnull(b.fRefuseQuantity,0)>isnull(b.fValidInQuan,0) or (b.igrouptype=2 - and isnull(b.inum,0)-isnull(b.frefusenum,0)>isnull(b.fvalidinnum,0))) and isnull(a.bStorageArrivalOrder,1)=1 and 1=1"; - if (!string.IsNullOrEmpty(strWhere)) + and isnull(b.inum,0)-isnull(b.frefusenum,0)>isnull(b.fvalidinnum,0))) and isnull(a.bStorageArrivalOrder,1)=1 and 1=1 + + +"; + + var aa = string.Join(" and ", strWhere.ToArray()); + + if (!string.IsNullOrEmpty(aa)) { - strSQL += $" and {strWhere} "; + strSQL += " and " + aa; } + var lookup = new Dictionary(); // return conn.Query(strSQL,null); var list = conn.Query(strSQL, (arrival, ArrivalDetail) => @@ -51,32 +68,54 @@ namespace NX.ERP.U8.Purchase public Model.Purchase.Arrival GetModel(int id) { - return this.GetList(" a.id=@Id ", new { id }).FirstOrDefault(); + List where = new List(); + + where.Add("a.id=@Id"); + + + return this.GetList(where, new { id }).FirstOrDefault(); } public IEnumerable Query(NX.ERP.Model.Request.Arrival arrival) { - var where = ""; + + List where = new List(); + + //处理- + if (!string.IsNullOrEmpty(arrival.cInvCode) ) + { + where.Add(" b.cinvcode = @cinvcode"); + } + if (arrival.ArrivalNolist != null && arrival.ArrivalNolist.Count > 0) + { + where.Add(" a.cCode in @cCodelist"); + } if (!string.IsNullOrEmpty(arrival.ArrivalNo)) { - where = " a.cCode like @Code "; + where.Add(" a.cCode = @cCode"); } - return this.GetList(where, new { Code = $"%{arrival.ArrivalNo}%" }); + return this.GetList(where, new { cCodelist = arrival.ArrivalNolist, cinvcode= arrival.cInvCode, cCode = arrival.ArrivalNo }); } public IEnumerable GetListByLastId(int Id) { + List where = new List(); - return this.GetList(" a.id>=@Id ", new { Id }); + where.Add(" a.id>=@Id "); + + return this.GetList(where, new { Id }); } public Model.Purchase.Arrival GetModel(string Code) { - return this.GetList(" a.cCode=@Code ", new { Code }).FirstOrDefault(); + List where = new List(); + + where.Add(" a.cCode=@Code "); + return this.GetList(where, new { Code }).FirstOrDefault(); } diff --git a/NX.ERP.WebAPi/Controllers/Pmc/WhreportController.cs b/NX.ERP.WebAPi/Controllers/Pmc/WhreportController.cs new file mode 100644 index 0000000..5eb0e1b --- /dev/null +++ b/NX.ERP.WebAPi/Controllers/Pmc/WhreportController.cs @@ -0,0 +1,26 @@ +using NX.ERP.U8.Purchase; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +using System.Web.Http; + +namespace NX.ERP.WebAPi.Controllers +{ + public class WhreportController : ApiController + { + [Obsolete] + [HttpPost] + [Route("api/Whreport/ArrivalGet")] + public IEnumerable ArrivalGet(NX.ERP.Model.Request.Arrival info) + { + var FinanceQuery = new NX.ERP.U8.Finance.WarehouseQuery(); + return FinanceQuery.ArrivalGet(info); + } + + + + + } +} \ No newline at end of file diff --git a/NX.ERP.WebAPi/Controllers/Purchase/ArrivalController.cs b/NX.ERP.WebAPi/Controllers/Purchase/ArrivalController.cs index 8c48689..44ae32c 100644 --- a/NX.ERP.WebAPi/Controllers/Purchase/ArrivalController.cs +++ b/NX.ERP.WebAPi/Controllers/Purchase/ArrivalController.cs @@ -9,15 +9,15 @@ namespace NX.ERP.WebAPi.Controllers { public class ArrivalController : ApiController { - [Obsolete] - [Route("api/Arrival/List")] - // GET api/values - [HttpGet] - public IEnumerable List() - { - var customerDAL = new ArrivalDAL(); - return customerDAL.GetList(); - } + //[Obsolete] + //[Route("api/Arrival/List")] + //// GET api/values + //[HttpGet] + //public IEnumerable List() + //{ + // var customerDAL = new ArrivalDAL(); + // return customerDAL.GetList(); + //} [Route("api/Arrival/Query")] // GET api/values @@ -37,7 +37,7 @@ namespace NX.ERP.WebAPi.Controllers var customerDAL = new ArrivalDAL(); return customerDAL.GetModel(Code); } - [Obsolete] + [Route("api/Arrival/list/{id}")] [HttpGet] public IEnumerable GetListByLastID(int id) diff --git a/NX.ERP.WebAPi/NX.ERP.WebAPi.csproj b/NX.ERP.WebAPi/NX.ERP.WebAPi.csproj index 2e72780..e797bd1 100644 --- a/NX.ERP.WebAPi/NX.ERP.WebAPi.csproj +++ b/NX.ERP.WebAPi/NX.ERP.WebAPi.csproj @@ -160,6 +160,7 @@ + diff --git a/NX.ERP.WebAPi/Web.config b/NX.ERP.WebAPi/Web.config index 173ec5d..9e67996 100644 --- a/NX.ERP.WebAPi/Web.config +++ b/NX.ERP.WebAPi/Web.config @@ -5,11 +5,11 @@ --> - - - - - + + + + + diff --git a/NX.ERP.Webapp/src/App.vue b/NX.ERP.Webapp/src/App.vue index 7563d1d..414767d 100644 --- a/NX.ERP.Webapp/src/App.vue +++ b/NX.ERP.Webapp/src/App.vue @@ -6,7 +6,7 @@ ERP查询 - + 物料在途在制查询表 跟单记录表 材料出库数据与品种 @@ -18,6 +18,16 @@ 采购查询汇总 + + + + 到货单 + + +
diff --git a/NX.ERP.Webapp/src/api/Purchase.js b/NX.ERP.Webapp/src/api/Purchase.js index 73bb080..55247be 100644 --- a/NX.ERP.Webapp/src/api/Purchase.js +++ b/NX.ERP.Webapp/src/api/Purchase.js @@ -21,3 +21,9 @@ export const Purchasesummom = (info) => { return axios.post('/api/Purchase/Purchasesummom', info) } + +export const ArrivalGet = (info) => { + return axios.post('/api/Whreport/ArrivalGet', info) +} + + diff --git a/NX.ERP.Webapp/src/bill/inventory-arrival.vue b/NX.ERP.Webapp/src/bill/inventory-arrival.vue new file mode 100644 index 0000000..51a7af6 --- /dev/null +++ b/NX.ERP.Webapp/src/bill/inventory-arrival.vue @@ -0,0 +1,385 @@ + + + + + + + \ No newline at end of file diff --git a/NX.ERP.Webapp/src/main.js b/NX.ERP.Webapp/src/main.js index 8400634..d94c06b 100644 --- a/NX.ERP.Webapp/src/main.js +++ b/NX.ERP.Webapp/src/main.js @@ -12,7 +12,9 @@ import VueRouter from "vue-router"; import routes from '@/route' +import print from './print' +Vue.use(print); // const routes=[ // { diff --git a/NX.ERP.Webapp/src/print/index.js b/NX.ERP.Webapp/src/print/index.js new file mode 100644 index 0000000..fb18f4f --- /dev/null +++ b/NX.ERP.Webapp/src/print/index.js @@ -0,0 +1,134 @@ +// 打印类属性、方法定义 +/* eslint-disable */ +const Print = function (dom, options) { + if (!(this instanceof Print)) return new Print(dom, options); + + this.options = this.extend({ + 'noPrint': '.no-print' + }, options); + + if ((typeof dom) === "string") { + this.dom = document.querySelector(dom); + } else { + this.isDOM(dom); + this.dom = this.isDOM(dom) ? dom : dom.$el; + } + this.init(); +}; +Print.prototype = { + init: function () { + var content = this.getStyle() + this.getHtml(); + this.writeIframe(content); + }, + extend: function (obj, obj2) { + for (var k in obj2) { + obj[k] = obj2[k]; + } + return obj; + }, + + getStyle: function () { + var str = "", + styles = document.querySelectorAll('style,link'); + for (var i = 0; i < styles.length; i++) { + str += styles[i].outerHTML; + } + str += ""; + str += ''; + return str; + }, + + getHtml: function () { + var inputs = document.querySelectorAll('input'); + var textareas = document.querySelectorAll('textarea'); + var selects = document.querySelectorAll('select'); + + for (var k = 0; k < inputs.length; k++) { + if (inputs[k].type == "checkbox" || inputs[k].type == "radio") { + if (inputs[k].checked == true) { + inputs[k].setAttribute('checked', "checked") + } else { + inputs[k].removeAttribute('checked') + } + } else if (inputs[k].type == "text") { + inputs[k].setAttribute('value', inputs[k].value) + } else { + inputs[k].setAttribute('value', inputs[k].value) + } + } + + for (var k2 = 0; k2 < textareas.length; k2++) { + if (textareas[k2].type == 'textarea') { + textareas[k2].innerHTML = textareas[k2].value + } + } + + for (var k3 = 0; k3 < selects.length; k3++) { + if (selects[k3].type == 'select-one') { + var child = selects[k3].children; + for (var i in child) { + if (child[i].tagName == 'OPTION') { + if (child[i].selected == true) { + child[i].setAttribute('selected', "selected") + } else { + child[i].removeAttribute('selected') + } + } + } + } + } + + return this.dom.outerHTML; + }, + + writeIframe: function (content) { + var w, doc, iframe = document.createElement('iframe'), + f = document.body.appendChild(iframe); + iframe.id = "myIframe"; + //iframe.style = "position:absolute;width:0;height:0;top:-10px;left:-10px;"; + iframe.setAttribute('style', 'position:absolute;width:0;height:0;top:-10px;left:-10px;'); + w = f.contentWindow || f.contentDocument; + doc = f.contentDocument || f.contentWindow.document; + doc.open(); + doc.write(content); + doc.close(); + var _this = this + iframe.onload = function(){ + _this.toPrint(w); + setTimeout(function () { + document.body.removeChild(iframe) + }, 100) + } + }, + + toPrint: function (frameWindow) { + try { + setTimeout(function () { + frameWindow.focus(); + try { + if (!frameWindow.document.execCommand('print', false, null)) { + frameWindow.print(); + } + } catch (e) { + frameWindow.print(); + } + frameWindow.close(); + }, 10); + } catch (err) { + console.log('err', err); + } + }, + isDOM: (typeof HTMLElement === 'object') ? + function (obj) { + return obj instanceof HTMLElement; + } : + function (obj) { + return obj && typeof obj === 'object' && obj.nodeType === 1 && typeof obj.nodeName === 'string'; + } +}; +const MyPlugin = {} +MyPlugin.install = function (Vue, options) { + // 4. 添加实例方法 + Vue.prototype.$print = Print +}; +export default MyPlugin diff --git a/NX.ERP.Webapp/src/route/index.js b/NX.ERP.Webapp/src/route/index.js index 7586828..1facfa2 100644 --- a/NX.ERP.Webapp/src/route/index.js +++ b/NX.ERP.Webapp/src/route/index.js @@ -8,6 +8,7 @@ import inventorybu from '@/views/inventory-bu.vue' import inventorypo from '@/views/inventory-po.vue' import inventorypoc from '@/views/inventory-poc.vue' import Purchasesum from '@/views/Purchasesum.vue' +import inventoryrrival from '@/bill/inventory-arrival.vue' export default [ { @@ -24,5 +25,6 @@ export default [ { path: '/inventorybu', component: inventorybu }, { path: '/inventorypo', component: inventorypo }, { path: '/inventorypoc', component: inventorypoc }, - { path: '/Purchasesum', component: Purchasesum } + { path: '/Purchasesum', component: Purchasesum }, + { path: '/inventoryrrival', component: inventoryrrival }, ]