Browse Source

形态转换增加查询条件

master
yangtm 9 months ago
parent
commit
f6529b1ea0
  1. 47
      WMS-BS/NFine.Application/WMS/ICSMTDOCApp.cs
  2. 23
      WMS-BS/NFine.Web/Areas/WMS/Views/ICSMTDOC/Metamorphosis.cshtml

47
WMS-BS/NFine.Application/WMS/ICSMTDOCApp.cs

@ -30,7 +30,9 @@ namespace NFine.Application.WMS
List<DbParameter> parameter = new List<DbParameter>(); List<DbParameter> parameter = new List<DbParameter>();
#region [SQL] #region [SQL]
string sql = @" SELECT * FROM (select row_number() over(partition by a.MTDOCCode ORDER BY a.CreateDateTime) as row, a.MTDOCCode,a.CreatePerson,a.CreateDateTime,a.Status,a.MUSER,a.MUSERName,a.MTIME from ICSMTDOC a";
string sql = @" SELECT * FROM (select row_number() over(partition by a.MTDOCCode ORDER BY a.CreateDateTime) as row, a.MTDOCCode,a.CreatePerson,a.CreateDateTime,a.Status,a.MUSER,a.MUSERName,a.MTIME
from ICSMTDOC a
LEFT JOIN ICSInventoryDetail detail on a.InvCode=detail.INVCode AND a.WHCode=detail.WHCode AND a.WorkPoint=detail.WorkPoint ";
sql += " WHERE 1=1"; sql += " WHERE 1=1";
sql = string.Format(sql, DbHelper.GetErpIp(), DbHelper.GetErpName()); sql = string.Format(sql, DbHelper.GetErpIp(), DbHelper.GetErpName());
#endregion #endregion
@ -41,31 +43,36 @@ namespace NFine.Application.WMS
{ {
sql += " and a.MTDOCCode like '%" + queryParam["MTDOCCode"].ToString() + "%' "; sql += " and a.MTDOCCode like '%" + queryParam["MTDOCCode"].ToString() + "%' ";
} }
if (!string.IsNullOrWhiteSpace(queryParam["Area"].ToString()))
{
sql += " and detail.LocationCode='" + queryParam["Area"].ToString() + "'";
}
if (!string.IsNullOrWhiteSpace(queryParam["ReleaseState"].ToString()))
{
sql += " and a.Status = '" + queryParam["ReleaseState"].ToString() + "' ";
}
} }
if (NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode != "admin") if (NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode != "admin")
{ {
sql += " and a.WorkPoint='" + NFine.Code.OperatorProvider.Provider.GetCurrent().Location + "'"; sql += " and a.WorkPoint='" + NFine.Code.OperatorProvider.Provider.GetCurrent().Location + "'";
} }
//if (NFine.Code.OperatorProvider.Provider.GetCurrent().RoleEnCode == "Vendor")
//{
// sql += " and a.VenCode='" + NFine.Code.OperatorProvider.Provider.GetCurrent().UserCode + "'";
//}
sql += " ) t WHERE t.Row=1"; sql += " ) t WHERE t.Row=1";
return Repository().FindTablePageBySql(sql.ToString(), parameter.ToArray(), ref jqgridparam); return Repository().FindTablePageBySql(sql.ToString(), parameter.ToArray(), ref jqgridparam);
} }
public DataTable GetSubGridJson(string MTDOCCode )
public DataTable GetSubGridJson(string MTDOCCode)
{ {
DataTable dt = new DataTable(); DataTable dt = new DataTable();
//var queryParam = queryJson.ToJObject(); //var queryParam = queryJson.ToJObject();
string sql = string.Empty; string sql = string.Empty;
List<DbParameter> parameter = new List<DbParameter>(); List<DbParameter> parameter = new List<DbParameter>();
string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location.TrimEnd(','); string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location.TrimEnd(',');
sql = @" select a.ID,a.DepCode,d.DepName,a.WHCode,c.WarehouseName,a.Sequence,b.InvCode,b.InvName,a.Quantity,a.Amount,a.MTDOCQuantity,case WHEN a.MTDOCType='1' then '转换前' ELSE '转换后' END as MTDOCType
sql = @" select a.ID,a.DepCode,d.DepName,a.WHCode,c.WarehouseName,a.Sequence,b.InvCode,b.InvName,a.Quantity,a.Amount,a.MTDOCQuantity,case WHEN a.MTDOCType='1' then '转换前' ELSE '转换后' END as MTDOCType , detail.LocationCode AS Area
from ICSMTDOC a from ICSMTDOC a
left join ICSInventory b on a.InvCode=b.InvCode and a.WorkPoint=b.WorkPoint left join ICSInventory b on a.InvCode=b.InvCode and a.WorkPoint=b.WorkPoint
left join ICSWarehouse c on a.WHCode=c.WarehouseCode and a.WorkPoint=c.WorkPoint left join ICSWarehouse c on a.WHCode=c.WarehouseCode and a.WorkPoint=c.WorkPoint
left join ICSDepartment d on a.DepCode=d.DepCode and a.WorkPoint=d.WorkPoint left join ICSDepartment d on a.DepCode=d.DepCode and a.WorkPoint=d.WorkPoint
LEFT JOIN ICSInventoryDetail detail on b.InvCode=detail.INVCode AND a.WHCode=detail.WHCode AND a.WorkPoint=detail.WorkPoint
WHERE a.MTDOCCode='{0}' and a.WorkPoint in ('{1}') order by a.Sequence "; WHERE a.MTDOCCode='{0}' and a.WorkPoint in ('{1}') order by a.Sequence ";
sql = string.Format(sql, MTDOCCode, WorkPoint); sql = string.Format(sql, MTDOCCode, WorkPoint);
return Repository().FindTableBySql(sql.ToString()); return Repository().FindTableBySql(sql.ToString());
@ -85,7 +92,7 @@ namespace NFine.Application.WMS
from ICSWareHouseLotInfo a from ICSWareHouseLotInfo a
inner join ICSInventoryLot b on a.LotNo=b.LotNo and a.WorkPoint=b.WorkPoint inner join ICSInventoryLot b on a.LotNo=b.LotNo and a.WorkPoint=b.WorkPoint
left join ICSInventory c on b.InvCode=c.InvCode and b.WorkPoint=c.WorkPoint left join ICSInventory c on b.InvCode=c.InvCode and b.WorkPoint=c.WorkPoint
WHERE a.Quantity>0 and a.WorkPoint = '" + WorkPoint + "'"+ wherestr;
WHERE a.Quantity>0 and a.WorkPoint = '" + WorkPoint + "'" + wherestr;
return Repository().FindTablePageBySql(sql.ToString(), parameter.ToArray(), ref jqgridparam); return Repository().FindTablePageBySql(sql.ToString(), parameter.ToArray(), ref jqgridparam);
} }
@ -107,7 +114,7 @@ namespace NFine.Application.WMS
} }
public DataTable GetCode( string Type, string Common,ref Pagination jqgridparam)
public DataTable GetCode(string Type, string Common, ref Pagination jqgridparam)
{ {
string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location; string WorkPoint = NFine.Code.OperatorProvider.Provider.GetCurrent().Location;
List<DbParameter> parameter = new List<DbParameter>(); List<DbParameter> parameter = new List<DbParameter>();
@ -115,7 +122,7 @@ namespace NFine.Application.WMS
DataTable table = new DataTable(); DataTable table = new DataTable();
string wherestr = ""; string wherestr = "";
string sql = string.Empty; string sql = string.Empty;
if (Type=="1")
if (Type == "1")
{ {
if (!string.IsNullOrEmpty(Common)) if (!string.IsNullOrEmpty(Common))
{ {
@ -270,7 +277,7 @@ namespace NFine.Application.WMS
{ {
string NewMTDOCCode = dts.Rows[0]["NewMTDOCCode"].ToString(); string NewMTDOCCode = dts.Rows[0]["NewMTDOCCode"].ToString();
int COUNT = Convert.ToInt32(NewMTDOCCode.Substring(8)) + 1; int COUNT = Convert.ToInt32(NewMTDOCCode.Substring(8)) + 1;
MTDOCCode = Time + COUNT.ToString().PadLeft(6,'0');
MTDOCCode = Time + COUNT.ToString().PadLeft(6, '0');
} }
Dictionary<string, object> dic = new Dictionary<string, object>(); Dictionary<string, object> dic = new Dictionary<string, object>();
foreach (var item in res) foreach (var item in res)
@ -294,7 +301,7 @@ namespace NFine.Application.WMS
{ {
string newLotNO = dt.Rows[0]["NewLotNo"].ToString(); string newLotNO = dt.Rows[0]["NewLotNo"].ToString();
int COUNT = Convert.ToInt32(newLotNO.Substring(newLotNO.LastIndexOf('-') + 1)) + 1; int COUNT = Convert.ToInt32(newLotNO.Substring(newLotNO.LastIndexOf('-') + 1)) + 1;
NewLotNo= LotNo + "-" + COUNT.ToString();
NewLotNo = LotNo + "-" + COUNT.ToString();
} }
#endregion #endregion
@ -315,7 +322,7 @@ namespace NFine.Application.WMS
string ocFree8 = oldLotNo.Rows[0]["cFree8"].ToString(); string ocFree8 = oldLotNo.Rows[0]["cFree8"].ToString();
string ocFree9 = oldLotNo.Rows[0]["cFree9"].ToString(); string ocFree9 = oldLotNo.Rows[0]["cFree9"].ToString();
string ocFree10 = oldLotNo.Rows[0]["cFree10"].ToString(); string ocFree10 = oldLotNo.Rows[0]["cFree10"].ToString();
if (jo["FlagProjectCode"].ToString()!=""&& jo["FlagProjectCode"].ToString()=="1")
if (jo["FlagProjectCode"].ToString() != "" && jo["FlagProjectCode"].ToString() == "1")
{ {
oProjectCode = jo["ProjectCode"].ToString(); oProjectCode = jo["ProjectCode"].ToString();
} }
@ -374,7 +381,7 @@ namespace NFine.Application.WMS
} }
//Colspan = jo["ProjectCode"].ToString() + "~" + jo["BatchCode"].ToString() + "~" + jo["Version"].ToString() + "~" + jo["Brand"].ToString() + "~" + jo["cFree1"].ToString() + "~" + jo["cFree2"].ToString() + "~" + jo["cFree3"].ToString() + "~" + jo["cFree4"].ToString() + "~" + jo["cFree5"].ToString() + "~" + jo["cFree6"].ToString() + "~" + jo["cFree7"].ToString() + "~" + jo["cFree8"].ToString() + "~" + jo["cFree9"].ToString() + "~" + jo["cFree10"].ToString(); //Colspan = jo["ProjectCode"].ToString() + "~" + jo["BatchCode"].ToString() + "~" + jo["Version"].ToString() + "~" + jo["Brand"].ToString() + "~" + jo["cFree1"].ToString() + "~" + jo["cFree2"].ToString() + "~" + jo["cFree3"].ToString() + "~" + jo["cFree4"].ToString() + "~" + jo["cFree5"].ToString() + "~" + jo["cFree6"].ToString() + "~" + jo["cFree7"].ToString() + "~" + jo["cFree8"].ToString() + "~" + jo["cFree9"].ToString() + "~" + jo["cFree10"].ToString();
Colspan = oProjectCode + "~" + oBatchCode + "~" + oVersion + "~" + oBrand + "~" + ocFree1 + "~" + ocFree2 + "~" + ocFree3 + "~" + ocFree4 + "~" + ocFree5+ "~" + ocFree6+ "~" + ocFree7+ "~" + ocFree8+ "~" + ocFree9+ "~" + ocFree10;
Colspan = oProjectCode + "~" + oBatchCode + "~" + oVersion + "~" + oBrand + "~" + ocFree1 + "~" + ocFree2 + "~" + ocFree3 + "~" + ocFree4 + "~" + ocFree5 + "~" + ocFree6 + "~" + ocFree7 + "~" + ocFree8 + "~" + ocFree9 + "~" + ocFree10;
string sqlsss = string.Format(@"select ID from ICSExtension where Colspan='{0}'", Colspan); string sqlsss = string.Format(@"select ID from ICSExtension where Colspan='{0}'", Colspan);
object ExtensionID = SqlHelper.ExecuteScalar(sqlsss); object ExtensionID = SqlHelper.ExecuteScalar(sqlsss);
if (ExtensionID == null) if (ExtensionID == null)
@ -419,7 +426,7 @@ namespace NFine.Application.WMS
select newid(),'{13}','{15}',ProductDate,ExpirationDate,Quantity,Amount,'{9}','102',MUSER,MUSERName,MTIME,WorkPoint,'{3}' from ICSInventoryLot select newid(),'{13}','{15}',ProductDate,ExpirationDate,Quantity,Amount,'{9}','102',MUSER,MUSERName,MTIME,WorkPoint,'{3}' from ICSInventoryLot
where LotNo='{3}'"; where LotNo='{3}'";
//新增条码关联 //新增条码关联
sql+= @" INSERT into ICSInventoryLotDetail(LotNo,TransCode,TransSequence,MUSER,MUSERName,MTIME,WorkPoint)
sql += @" INSERT into ICSInventoryLotDetail(LotNo,TransCode,TransSequence,MUSER,MUSERName,MTIME,WorkPoint)
select '{13}',TransCode,TransSequence,MUSER,MUSERName,MTIME,WorkPoint from ICSInventoryLotDetail select '{13}',TransCode,TransSequence,MUSER,MUSERName,MTIME,WorkPoint from ICSInventoryLotDetail
where LotNo='{3}'"; where LotNo='{3}'";
@ -428,7 +435,7 @@ namespace NFine.Application.WMS
} }
if (SqlHelper.CmdExecuteNonQueryLi(sql) > 0) if (SqlHelper.CmdExecuteNonQueryLi(sql) > 0)
{ {
msg ="";
msg = "";
} }
else else
{ {
@ -482,7 +489,7 @@ namespace NFine.Application.WMS
sql += @"INSERT into ICSWareHouseLotInfoLog(ID,Identification,TransCode,TransSequence,LotNo,InvCode,ToWarehouseCode,ToLocationCode, sql += @"INSERT into ICSWareHouseLotInfoLog(ID,Identification,TransCode,TransSequence,LotNo,InvCode,ToWarehouseCode,ToLocationCode,
Quantity,Lock,TransType,BusinessCode, Quantity,Lock,TransType,BusinessCode,
MUSER,MUSERName,MTIME,WorkPoint,EATTRIBUTE1) MUSER,MUSERName,MTIME,WorkPoint,EATTRIBUTE1)
select newid(),'"+ Identification + "',d.MTDOCCode,d.Sequence, a.LotNo,a.InvCode,a.WarehouseCode,a.LocationCode,a.Quantity,'0' ,'10','36','" + MUSER + @"','" + MUSERNAME + @"','" + TimeNow + @"',a.WorkPoint,''
select newid(),'" + Identification + "',d.MTDOCCode,d.Sequence, a.LotNo,a.InvCode,a.WarehouseCode,a.LocationCode,a.Quantity,'0' ,'10','36','" + MUSER + @"','" + MUSERNAME + @"','" + TimeNow + @"',a.WorkPoint,''
from ICSWareHouseLotInfo a from ICSWareHouseLotInfo a
left join dbo.ICSInventoryLot b on a.LotNo=b.LotNo and a.WorkPoint=b.WorkPoint left join dbo.ICSInventoryLot b on a.LotNo=b.LotNo and a.WorkPoint=b.WorkPoint
left join dbo.ICSInventoryLotDetail c on b.LotNo=c.LotNo and b.WorkPoint=c.WorkPoint left join dbo.ICSInventoryLotDetail c on b.LotNo=c.LotNo and b.WorkPoint=c.WorkPoint
@ -507,12 +514,12 @@ namespace NFine.Application.WMS
select Costre, Sequence,GroupNO,[Type],InvCode,WHCode,BatchCode,ProjectCode,Quantity,Amount,Version,Brand,cFree1,cFree2,cFree3,cFree4,cFree5,cFree6,cFree7,cFree8,cFree9,cFree10 FROM #TempERP select Costre, Sequence,GroupNO,[Type],InvCode,WHCode,BatchCode,ProjectCode,Quantity,Amount,Version,Brand,cFree1,cFree2,cFree3,cFree4,cFree5,cFree6,cFree7,cFree8,cFree9,cFree10 FROM #TempERP
DROP TABLE #TempERP"; DROP TABLE #TempERP";
sql = string.Format(sql, MTDOCCode, WorkPoint); sql = string.Format(sql, MTDOCCode, WorkPoint);
msg= CmdExecuteData(sql, MTDOCCode, Identification);
msg = CmdExecuteData(sql, MTDOCCode, Identification);
return msg; return msg;
} }
public string CmdExecuteData(string sql,string MTDOCCode,string Identification)
public string CmdExecuteData(string sql, string MTDOCCode, string Identification)
{ {
string msg = ""; string msg = "";
try try
@ -557,7 +564,7 @@ namespace NFine.Application.WMS
inner join ICSMTDOC b on a.LotNo=b.LotNo and a.WorkPoint=b.WorkPoint inner join ICSMTDOC b on a.LotNo=b.LotNo and a.WorkPoint=b.WorkPoint
where b.MTDOCCode='{0}' and b.Sequence='{1}' and a.Identification='{2}'"; where b.MTDOCCode='{0}' and b.Sequence='{1}' and a.Identification='{2}'";
ERPSql += @" update ICSMTDOC set MTDOCID='{3}',MTDOCDetailID='{4}' where MTDOCCode='{0}' and Sequence='{1}'"; ERPSql += @" update ICSMTDOC set MTDOCID='{3}',MTDOCDetailID='{4}' where MTDOCCode='{0}' and Sequence='{1}'";
ERPSql = string.Format(ERPSql, MTDOCCode, det["Sequence"].ToString(), Identification, jo["ID"].ToString(), det["DetailID"].ToString(), jo["MTCode"].ToString() , det["Sequence"].ToString());
ERPSql = string.Format(ERPSql, MTDOCCode, det["Sequence"].ToString(), Identification, jo["ID"].ToString(), det["DetailID"].ToString(), jo["MTCode"].ToString(), det["Sequence"].ToString());
} }
} }
SqlCommandHelper.CmdExecuteNonQuery(ERPSql, cmd); SqlCommandHelper.CmdExecuteNonQuery(ERPSql, cmd);

23
WMS-BS/NFine.Web/Areas/WMS/Views/ICSMTDOC/Metamorphosis.cshtml

@ -15,6 +15,8 @@
var $gridList = $("#gridList"); var $gridList = $("#gridList");
var queryJson = { var queryJson = {
MTDOCCode: $("#txt_MTDOCCode").val(), MTDOCCode: $("#txt_MTDOCCode").val(),
Area: $("#txt_Area").val(),
ReleaseState: $("#selShow").val(),
} }
$gridList.dataGrid({ $gridList.dataGrid({
url: "/WMS/ICSMTDOC/GetGridJson" + "?" + Math.random(), url: "/WMS/ICSMTDOC/GetGridJson" + "?" + Math.random(),
@ -76,6 +78,8 @@
var warehouse = $("#warehouse a.active").attr('data-value'); var warehouse = $("#warehouse a.active").attr('data-value');
var queryJson = { var queryJson = {
MTDOCCode: $("#txt_MTDOCCode").val(), MTDOCCode: $("#txt_MTDOCCode").val(),
Area: $("#txt_Area").val(),
ReleaseState: $("#selShow").val(),
} }
$gridList.jqGrid('setGridParam', { $gridList.jqGrid('setGridParam', {
postData: { queryJson: JSON.stringify(queryJson) }, postData: { queryJson: JSON.stringify(queryJson) },
@ -107,6 +111,7 @@
{ label: '部门代码', name: 'DepCode', width: 100, align: 'left' }, { label: '部门代码', name: 'DepCode', width: 100, align: 'left' },
{ label: '部门名称', name: 'DepName', width: 100, align: 'left' }, { label: '部门名称', name: 'DepName', width: 100, align: 'left' },
{ label: '仓库代码', name: 'WHCode', width: 100, align: 'left' }, { label: '仓库代码', name: 'WHCode', width: 100, align: 'left' },
{ label: '区域', name: 'Area', width: 100, align: 'left' },
{ label: '仓库名称', name: 'WarehouseName', width: 100, align: 'left' }, { label: '仓库名称', name: 'WarehouseName', width: 100, align: 'left' },
//{ label: '条码', name: 'LotNo', width: 100, align: 'left' }, //{ label: '条码', name: 'LotNo', width: 100, align: 'left' },
{ label: '料品编码', name: 'InvCode', width: 100, align: 'left' }, { label: '料品编码', name: 'InvCode', width: 100, align: 'left' },
@ -204,6 +209,24 @@
<input id="txt_MTDOCCode" type="text" class="form-control" style="width: 100px;"> <input id="txt_MTDOCCode" type="text" class="form-control" style="width: 100px;">
</div> </div>
</td> </td>
<td style="text-align:right;"><label class="lglabel " for="txt_Area">&nbsp;&nbsp;&nbsp;&nbsp;区域</label>:</td>
<td>
<div class="input-group ">
<input id="txt_Area" type="text" class="form-control " style="width: 100px;">
</div>
</td>
<td>
<label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;单据状态:</label>
</td>
<td>
<div class="input-group">
<select id="selShow" name="F_Target" class="form-control" style="width: 105px;">
<option value="1">开立</option>
<option value="2">审核</option>
<option value="3">关闭</option>
</select>
</div>
</td>
<td> <td>
<span class="input-group-btn"> <span class="input-group-btn">
<button id="btn_search" type="button" class="btn btn-primary"><i class="fa fa-search"></i></button> <button id="btn_search" type="button" class="btn btn-primary"><i class="fa fa-search"></i></button>

Loading…
Cancel
Save