插单子完成
This commit is contained in:
parent
835025afe9
commit
53fbedab77
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -164,7 +164,7 @@ namespace Model.DBModel
|
|||||||
///
|
///
|
||||||
[SugarColumn(ColumnName = "year")]
|
[SugarColumn(ColumnName = "year")]
|
||||||
[ExcelIgnore]
|
[ExcelIgnore]
|
||||||
public float Year { get; set; }
|
public int Year { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 周
|
/// 周
|
||||||
@ -172,7 +172,7 @@ namespace Model.DBModel
|
|||||||
///
|
///
|
||||||
[SugarColumn(ColumnName = "week")]
|
[SugarColumn(ColumnName = "week")]
|
||||||
[ExcelIgnore]
|
[ExcelIgnore]
|
||||||
public float Week { get; set; }
|
public int Week { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -103,13 +103,45 @@ namespace ZR.Model.MES.pro
|
|||||||
[SugarColumn(ColumnName = "remark2")]
|
[SugarColumn(ColumnName = "remark2")]
|
||||||
[ExcelColumn(Name = "备注2", IndexName = "L")]
|
[ExcelColumn(Name = "备注2", IndexName = "L")]
|
||||||
public string Remark2 { get; set; }
|
public string Remark2 { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 备注3
|
/// 备注3,识别是否需要工单
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(ColumnName = "remark3")]
|
[SugarColumn(ColumnName = "remark3")]
|
||||||
[ExcelIgnore]
|
[ExcelIgnore]
|
||||||
public string Remark3 { get; set; }
|
public string Remark3 { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 备注4 :来源
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "remark4")]
|
||||||
|
[ExcelIgnore]
|
||||||
|
public string Remark4 { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 序号
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "sort")]
|
||||||
|
[ExcelIgnore]
|
||||||
|
public int Sort { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 客户工单号
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "client_workorder")]
|
||||||
|
[ExcelIgnore]
|
||||||
|
public string ClientWorkorder { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 状态:0初态 1上线
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(ColumnName = "status")]
|
||||||
|
[ExcelIgnore]
|
||||||
|
public int Status { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 年
|
/// 年
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -42,7 +42,7 @@ namespace ZR.Service.mes.pro
|
|||||||
.ToExpression();
|
.ToExpression();
|
||||||
|
|
||||||
int totalCount = 0;
|
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);
|
return (proWorkorderList, totalCount);
|
||||||
}
|
}
|
||||||
@ -76,14 +76,25 @@ namespace ZR.Service.mes.pro
|
|||||||
// 更新生产计划
|
// 更新生产计划
|
||||||
if (workorderList != null && workorderList.Count > 0)
|
if (workorderList != null && workorderList.Count > 0)
|
||||||
{
|
{
|
||||||
workorderList.ForEach(it =>
|
workorderList.ForEach(item =>
|
||||||
{
|
{
|
||||||
it.Id = "WO" + DateTime.Now.ToString("yyyyMMdd") + max_id.ToString("000");
|
item.Id = "WO" + DateTime.Now.ToString("yyyyMMdd") + max_id.ToString("000");
|
||||||
it.Remark3 = "Excel导入";
|
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++;
|
max_id++;
|
||||||
});
|
});
|
||||||
|
|
||||||
foreach (ProWorkorder_v2 item in workorderList)
|
foreach (ProWorkorder_v2 item in workorderList)
|
||||||
{
|
{
|
||||||
|
// 修正计划
|
||||||
ProWorklplan_v2 planItem = Context.Queryable<ProWorklplan_v2>().Where(it => it.Id == item.FinishedPartNumber).First();
|
ProWorklplan_v2 planItem = Context.Queryable<ProWorklplan_v2>().Where(it => it.Id == item.FinishedPartNumber).First();
|
||||||
if (planItem != null)
|
if (planItem != null)
|
||||||
{
|
{
|
||||||
@ -104,6 +115,9 @@ namespace ZR.Service.mes.pro
|
|||||||
Context.Deleteable<ProWorkorder_v2>().Where(it => it.Year == workorderList[0].Year)
|
Context.Deleteable<ProWorkorder_v2>().Where(it => it.Year == workorderList[0].Year)
|
||||||
.Where(it => it.Week == workorderList[0].Week)
|
.Where(it => it.Week == workorderList[0].Week)
|
||||||
.Where(it => it.Date == workorderList[0].Date).ExecuteCommand();
|
.Where(it => it.Date == workorderList[0].Date).ExecuteCommand();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//插入
|
//插入
|
||||||
Context.Insertable(workorderList).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.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();
|
return Context.Insertable(workorder).ExecuteCommand();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user