插单子完成
This commit is contained in:
@@ -42,7 +42,7 @@ namespace ZR.Service.mes.pro
|
||||
.ToExpression();
|
||||
|
||||
int totalCount = 0;
|
||||
List<ProWorkorder_v2> proWorkorderList = Context.Queryable<ProWorkorder_v2>().Where(predicate).OrderBy(it => it.Id).ToPageList(pageNum, pageSize, ref totalCount);
|
||||
List<ProWorkorder_v2> proWorkorderList = Context.Queryable<ProWorkorder_v2>().Where(predicate).OrderBy(it => it.Sort).ToPageList(pageNum, pageSize, ref totalCount);
|
||||
|
||||
return (proWorkorderList, totalCount);
|
||||
}
|
||||
@@ -76,14 +76,25 @@ namespace ZR.Service.mes.pro
|
||||
// 更新生产计划
|
||||
if (workorderList != null && workorderList.Count > 0)
|
||||
{
|
||||
workorderList.ForEach(it =>
|
||||
workorderList.ForEach(item =>
|
||||
{
|
||||
it.Id = "WO" + DateTime.Now.ToString("yyyyMMdd") + max_id.ToString("000");
|
||||
it.Remark3 = "Excel导入";
|
||||
item.Id = "WO" + DateTime.Now.ToString("yyyyMMdd") + max_id.ToString("000");
|
||||
item.Remark4 = "Excel导入";
|
||||
// 添加属性
|
||||
item.Sort = Convert.ToInt32(item.Year.ToString("0000").Substring(2) + item.Week.ToString("00") + item.Date.ToString("00") + workorderList.IndexOf(item).ToString("000"));
|
||||
|
||||
if (item.Remark2 == "批量")
|
||||
{
|
||||
item.Remark3 = "是";
|
||||
}
|
||||
item.Status = 0;
|
||||
|
||||
max_id++;
|
||||
});
|
||||
|
||||
foreach (ProWorkorder_v2 item in workorderList)
|
||||
{
|
||||
// 修正计划
|
||||
ProWorklplan_v2 planItem = Context.Queryable<ProWorklplan_v2>().Where(it => it.Id == item.FinishedPartNumber).First();
|
||||
if (planItem != null)
|
||||
{
|
||||
@@ -104,6 +115,9 @@ namespace ZR.Service.mes.pro
|
||||
Context.Deleteable<ProWorkorder_v2>().Where(it => it.Year == workorderList[0].Year)
|
||||
.Where(it => it.Week == workorderList[0].Week)
|
||||
.Where(it => it.Date == workorderList[0].Date).ExecuteCommand();
|
||||
|
||||
|
||||
|
||||
//插入
|
||||
Context.Insertable(workorderList).ExecuteCommand();
|
||||
|
||||
@@ -221,6 +235,21 @@ namespace ZR.Service.mes.pro
|
||||
|
||||
|
||||
workorder.Id = "WO" + DateTime.Now.ToString("yyyyMMdd") + Getworkorderid_max().ToString("000");
|
||||
workorder.Remark4 = "手动插入";
|
||||
workorder.Status = 0;
|
||||
if (workorder.Remark2 == "批量")
|
||||
{
|
||||
workorder.Remark3 = "是";
|
||||
}
|
||||
// 更改以下工单的顺序
|
||||
if (workorder.Sort > 0)
|
||||
{
|
||||
int max = Convert.ToInt32(workorder.Sort.ToString().Substring(0, 6) + "999");
|
||||
Context.Updateable<ProWorkorder_v2>().Where(it => it.Sort >= workorder.Sort && it.Sort <= max).SetColumns(it => it.Sort == it.Sort + 1).ExecuteCommand();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
return Context.Insertable(workorder).ExecuteCommand();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user