|
@ -235,81 +235,88 @@ namespace QMAPP.FJC.BLL.FIS |
|
|
{ |
|
|
{ |
|
|
DataResult<int> result = new DataResult<int>(); |
|
|
DataResult<int> result = new DataResult<int>(); |
|
|
//基本信息
|
|
|
//基本信息
|
|
|
|
|
|
|
|
|
try |
|
|
try |
|
|
{ |
|
|
{ |
|
|
if (model.MATERIAL_CODE.Length <= 10) |
|
|
model.PID = Guid.NewGuid().ToString(); |
|
|
|
|
|
model.PLAN_STATE = "0"; |
|
|
|
|
|
model.PLANSOURCE = model.PLANSOURCE; |
|
|
|
|
|
//var materialcode = "";
|
|
|
|
|
|
//if (model.MATERIAL_CODE.Substring(model.MATERIAL_CODE.Length - 1, 1) == "L" || model.MATERIAL_CODE.Substring(model.MATERIAL_CODE.Length - 1, 1) == "R")
|
|
|
|
|
|
// materialcode = model.MATERIAL_CODE.Substring(model.MATERIAL_CODE.Length - 1, 1);
|
|
|
|
|
|
//else
|
|
|
|
|
|
// materialcode = model.MATERIAL_CODE;
|
|
|
|
|
|
//Pbom pbomcode = new PbomDAL().TJGet(new Pbom { MATERIAL_CODE = materialcode });
|
|
|
|
|
|
//model.PBOM_CODE = pbomcode.PBOM_CODE;
|
|
|
|
|
|
string workcentercode = new WorkCellDAL().GetWorkcenter(model.ORDER_TYPE); |
|
|
|
|
|
model.WORKCENTER_CODE = workcentercode; |
|
|
|
|
|
if (model.WORKCENTER_CODE != "") |
|
|
{ |
|
|
{ |
|
|
var listMatral = new TJDoorPlankPlanDAL(); |
|
|
string factory = new FactoryDAL().GetFactoryWithWorkcenter(model.WORKCENTER_CODE); |
|
|
var ListMachine = listMatral.GetListMachine(model.MATERIAL_CODE); |
|
|
model.FACTORY_CODE = factory; |
|
|
foreach (var Machint in ListMachine) |
|
|
|
|
|
{ |
|
|
|
|
|
model.PID = Guid.NewGuid().ToString(); |
|
|
|
|
|
model.PLAN_STATE = "0"; |
|
|
|
|
|
model.PLANSOURCE = model.PLANSOURCE; |
|
|
|
|
|
model.MATERIAL_CODE = Machint.MATERIALNO; |
|
|
|
|
|
model.MATERIAL_NAME = Machint.MATERIALNAME; |
|
|
|
|
|
Pbom pbomcode = new PbomDAL().Get(new Pbom { MATERIAL_CODE = Machint.MATERIALNO }); |
|
|
|
|
|
model.PBOM_CODE = pbomcode.PBOM_CODE; |
|
|
|
|
|
string workcentercode = new WorkCellDAL().GetWorkcenter(model.ORDER_TYPE); |
|
|
|
|
|
model.WORKCENTER_CODE = workcentercode; |
|
|
|
|
|
if (model.WORKCENTER_CODE != "") |
|
|
|
|
|
{ |
|
|
|
|
|
string factory = new FactoryDAL().GetFactoryWithWorkcenter(model.WORKCENTER_CODE); |
|
|
|
|
|
model.FACTORY_CODE = factory; |
|
|
|
|
|
} |
|
|
|
|
|
QMAPP.MD.Entity.ProcessRoute routecode = new QMAPP.MD.DAL.ProcessRouteDAL().RouteWithMaterial(Machint.MATERIALNO); |
|
|
|
|
|
//QMAPP.MD.Entity.ProcessRoute routecode = new QMAPP.MD.DAL.ProcessRouteDAL().RouteWithMaterial(model.MATERIAL_CODE);
|
|
|
|
|
|
model.ROUTE_CODE = routecode != null ? routecode.ROUTE_CODE : ""; |
|
|
|
|
|
model.CREATEUSER = this.LoginUser.UserID; |
|
|
|
|
|
model.CREATEDATE = DateTime.Now; |
|
|
|
|
|
model.UPDATEUSER = model.CREATEUSER; |
|
|
|
|
|
model.UPDATEDATE = model.CREATEDATE; |
|
|
|
|
|
DoorPlankPlanDAL cmdDAL = new DoorPlankPlanDAL(); |
|
|
|
|
|
FISPlan condition = new FISPlan(); |
|
|
|
|
|
condition.PREFIX = "DP"; |
|
|
|
|
|
condition.DATASTR = model.PLAN_DATE.ToString("yyyyMMdd"); |
|
|
|
|
|
//获取流水号
|
|
|
|
|
|
FISPlan info = this.GetOrderPlanSeq(condition); |
|
|
|
|
|
//计划单号
|
|
|
|
|
|
model.PLAN_SEQ = info.SEQSTR; |
|
|
|
|
|
model.PLAN_NO = condition.PREFIX + condition.DATASTR + info.SEQSTR; |
|
|
|
|
|
result.Result = new DoorPlankPlanDAL().Insert(model); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
model.PID = Guid.NewGuid().ToString(); |
|
|
|
|
|
model.PLAN_STATE = "0"; |
|
|
|
|
|
model.PLANSOURCE = model.PLANSOURCE; |
|
|
|
|
|
Pbom pbomcode = new PbomDAL().Get(new Pbom { MATERIAL_CODE = model.MATERIAL_CODE }); |
|
|
|
|
|
model.PBOM_CODE = pbomcode.PBOM_CODE; |
|
|
|
|
|
string workcentercode = new WorkCellDAL().GetWorkcenter(model.ORDER_TYPE); |
|
|
|
|
|
model.WORKCENTER_CODE = workcentercode; |
|
|
|
|
|
if (model.WORKCENTER_CODE != "") |
|
|
|
|
|
{ |
|
|
|
|
|
string factory = new FactoryDAL().GetFactoryWithWorkcenter(model.WORKCENTER_CODE); |
|
|
|
|
|
model.FACTORY_CODE = factory; |
|
|
|
|
|
} |
|
|
|
|
|
QMAPP.MD.Entity.ProcessRoute routecode = new QMAPP.MD.DAL.ProcessRouteDAL().RouteWithMaterial(model.MATERIAL_CODE); |
|
|
|
|
|
//QMAPP.MD.Entity.ProcessRoute routecode = new QMAPP.MD.DAL.ProcessRouteDAL().RouteWithMaterial(model.MATERIAL_CODE);
|
|
|
|
|
|
model.ROUTE_CODE = routecode != null ? routecode.ROUTE_CODE : ""; |
|
|
|
|
|
model.CREATEUSER = this.LoginUser.UserID; |
|
|
|
|
|
model.CREATEDATE = DateTime.Now; |
|
|
|
|
|
model.UPDATEUSER = model.CREATEUSER; |
|
|
|
|
|
model.UPDATEDATE = model.CREATEDATE; |
|
|
|
|
|
DoorPlankPlanDAL cmdDAL = new DoorPlankPlanDAL(); |
|
|
|
|
|
FISPlan condition = new FISPlan(); |
|
|
|
|
|
condition.PREFIX = "DP"; |
|
|
|
|
|
condition.DATASTR = model.PLAN_DATE.ToString("yyyyMMdd"); |
|
|
|
|
|
//获取流水号
|
|
|
|
|
|
FISPlan info = this.GetOrderPlanSeq(condition); |
|
|
|
|
|
//计划单号
|
|
|
|
|
|
model.PLAN_SEQ = info.SEQSTR; |
|
|
|
|
|
model.PLAN_NO = condition.PREFIX + condition.DATASTR + info.SEQSTR; |
|
|
|
|
|
result.Result = new DoorPlankPlanDAL().Insert(model); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
QMAPP.MD.Entity.ProcessRoute routecode = new QMAPP.MD.DAL.ProcessRouteDAL().RouteWithMaterial(model.MATERIAL_CODE); |
|
|
|
|
|
//QMAPP.MD.Entity.ProcessRoute routecode = new QMAPP.MD.DAL.ProcessRouteDAL().RouteWithMaterial(model.MATERIAL_CODE);
|
|
|
|
|
|
model.ROUTE_CODE = "DP_ASSEMBLY_770B"; |
|
|
|
|
|
model.CREATEUSER = this.LoginUser.UserID; |
|
|
|
|
|
model.CREATEDATE = DateTime.Now; |
|
|
|
|
|
model.UPDATEUSER = model.CREATEUSER; |
|
|
|
|
|
model.UPDATEDATE = model.CREATEDATE; |
|
|
|
|
|
DoorPlankPlanDAL cmdDAL = new DoorPlankPlanDAL(); |
|
|
|
|
|
FISPlan condition = new FISPlan(); |
|
|
|
|
|
condition.PREFIX = "DP"; |
|
|
|
|
|
condition.DATASTR = model.PLAN_DATE.ToString("yyyyMMdd"); |
|
|
|
|
|
//获取流水号
|
|
|
|
|
|
FISPlan info = this.GetOrderPlanSeq(condition); |
|
|
|
|
|
//计划单号
|
|
|
|
|
|
model.PLAN_SEQ = info.SEQSTR; |
|
|
|
|
|
model.PLAN_NO = condition.PREFIX + condition.DATASTR + info.SEQSTR; |
|
|
|
|
|
result.Result = new DoorPlankPlanDAL().Insert(model); |
|
|
|
|
|
|
|
|
|
|
|
//if (model.MATERIAL_CODE.Length <= 10)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// //var listMatral = new TJDoorPlankPlanDAL();
|
|
|
|
|
|
// //var ListMachine = listMatral.GetListMachine(model.MATERIAL_CODE);
|
|
|
|
|
|
// foreach (var Machint in ListMachine)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// model.PID = Guid.NewGuid().ToString();
|
|
|
|
|
|
// model.PLAN_STATE = "0";
|
|
|
|
|
|
// model.PLANSOURCE = model.PLANSOURCE;
|
|
|
|
|
|
// model.MATERIAL_CODE = Machint.MATERIALNO;
|
|
|
|
|
|
// model.MATERIAL_NAME = Machint.MATERIALNAME;
|
|
|
|
|
|
// Pbom pbomcode = new PbomDAL().Get(new Pbom { MATERIAL_CODE = Machint.MATERIALNO });
|
|
|
|
|
|
// model.PBOM_CODE = pbomcode.PBOM_CODE;
|
|
|
|
|
|
// string workcentercode = new WorkCellDAL().GetWorkcenter(model.ORDER_TYPE);
|
|
|
|
|
|
// model.WORKCENTER_CODE = workcentercode;
|
|
|
|
|
|
// if (model.WORKCENTER_CODE != "")
|
|
|
|
|
|
// {
|
|
|
|
|
|
// string factory = new FactoryDAL().GetFactoryWithWorkcenter(model.WORKCENTER_CODE);
|
|
|
|
|
|
// model.FACTORY_CODE = factory;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// QMAPP.MD.Entity.ProcessRoute routecode = new QMAPP.MD.DAL.ProcessRouteDAL().RouteWithMaterial(Machint.MATERIALNO);
|
|
|
|
|
|
// //QMAPP.MD.Entity.ProcessRoute routecode = new QMAPP.MD.DAL.ProcessRouteDAL().RouteWithMaterial(model.MATERIAL_CODE);
|
|
|
|
|
|
// model.ROUTE_CODE = routecode != null ? routecode.ROUTE_CODE : "";
|
|
|
|
|
|
// model.CREATEUSER = this.LoginUser.UserID;
|
|
|
|
|
|
// model.CREATEDATE = DateTime.Now;
|
|
|
|
|
|
// model.UPDATEUSER = model.CREATEUSER;
|
|
|
|
|
|
// model.UPDATEDATE = model.CREATEDATE;
|
|
|
|
|
|
// DoorPlankPlanDAL cmdDAL = new DoorPlankPlanDAL();
|
|
|
|
|
|
// FISPlan condition = new FISPlan();
|
|
|
|
|
|
// condition.PREFIX = "DP";
|
|
|
|
|
|
// condition.DATASTR = model.PLAN_DATE.ToString("yyyyMMdd");
|
|
|
|
|
|
// //获取流水号
|
|
|
|
|
|
// FISPlan info = this.GetOrderPlanSeq(condition);
|
|
|
|
|
|
// //计划单号
|
|
|
|
|
|
// model.PLAN_SEQ = info.SEQSTR;
|
|
|
|
|
|
// model.PLAN_NO = condition.PREFIX + condition.DATASTR + info.SEQSTR;
|
|
|
|
|
|
// result.Result = new DoorPlankPlanDAL().Insert(model);
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
//else
|
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
|
|
|
|
//}
|
|
|
} |
|
|
} |
|
|
catch (Exception ex) |
|
|
catch (Exception ex) |
|
|
{ |
|
|
{ |
|
@ -785,6 +792,310 @@ namespace QMAPP.FJC.BLL.FIS |
|
|
} |
|
|
} |
|
|
#endregion
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 发布
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 发布信息
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name=""></param>
|
|
|
|
|
|
/// <returns>发布个数</returns>
|
|
|
|
|
|
public DataResult<int> TJPutOut(string strs) |
|
|
|
|
|
{ |
|
|
|
|
|
string[] list = strs.Split(":".ToCharArray()); |
|
|
|
|
|
DataResult<int> result = new DataResult<int>(); |
|
|
|
|
|
try |
|
|
|
|
|
{ |
|
|
|
|
|
OrderPlanDAL orderPlandal = new OrderPlanDAL(); |
|
|
|
|
|
|
|
|
|
|
|
List<OrderPlan> validorderPlanList = new List<OrderPlan>(); |
|
|
|
|
|
List<OrderPlan> putOutPlanList = new List<OrderPlan>(); |
|
|
|
|
|
|
|
|
|
|
|
foreach (string str in list) |
|
|
|
|
|
{ |
|
|
|
|
|
OrderPlan op = orderPlandal.Get(new OrderPlan { PID = str }); |
|
|
|
|
|
|
|
|
|
|
|
if (op.PLAN_STATE != EnumGeter.PLANSTATE.INIT.GetHashCode().ToString()) |
|
|
|
|
|
{ |
|
|
|
|
|
validorderPlanList.Add(op); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
putOutPlanList.Add(op); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (validorderPlanList.Count > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
result.IsSuccess = false; |
|
|
|
|
|
result.Msg = "只有初始状态下的订单能够进行发布!"; |
|
|
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
DataTable totalDt = GetWorkOrderTable(); |
|
|
|
|
|
foreach (var op in putOutPlanList) |
|
|
|
|
|
{ |
|
|
|
|
|
op.PLAN_STATE = EnumGeter.PLANSTATE.COMMIT.GetHashCode().ToString(); |
|
|
|
|
|
op.UPDATEUSER = this.LoginUser.UserID; |
|
|
|
|
|
totalDt = this.TJPutOutOrderPlan(op, totalDt); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
using (IDataSession session = AppDataFactory.CreateMainSession()) |
|
|
|
|
|
{ |
|
|
|
|
|
IDbConnection dbConn = DbManager.MainConnectionInfo.Connection; |
|
|
|
|
|
if (dbConn.State == ConnectionState.Closed) |
|
|
|
|
|
{ |
|
|
|
|
|
dbConn.Open(); |
|
|
|
|
|
} |
|
|
|
|
|
IDbTransaction ids = dbConn.BeginTransaction(); |
|
|
|
|
|
|
|
|
|
|
|
orderPlandal.BaseSession = session; |
|
|
|
|
|
foreach (var op in putOutPlanList) |
|
|
|
|
|
{ |
|
|
|
|
|
orderPlandal.Update(op); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
session.DbHelper.BulkCopyData(totalDt, "T_PP_WORKORDER", dbConn, ids); |
|
|
|
|
|
ids.Commit(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
result.IsSuccess = true; |
|
|
|
|
|
return result; |
|
|
|
|
|
} |
|
|
|
|
|
catch (Exception ex) |
|
|
|
|
|
{ |
|
|
|
|
|
throw ex; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 发布信息
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="">信息</param>
|
|
|
|
|
|
/// <returns>发布个数</returns>
|
|
|
|
|
|
public DataTable TJPutOutOrderPlan(OrderPlan info, DataTable workOrderDt) |
|
|
|
|
|
{ |
|
|
|
|
|
WorkCellDAL workCelldal = new WorkCellDAL(); |
|
|
|
|
|
|
|
|
|
|
|
var dicPRI = new DictManageBLL(Dict.DictKind.ORDERPRI); |
|
|
|
|
|
|
|
|
|
|
|
//if (list.Count <= 0)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// return null;
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
if ((info.MATERIAL_CODE.Substring(0,4) == "018D"&& info.MATERIAL_CODE.Length > 10)|| (info.MATERIAL_CODE.Substring(0, 3) == "770" && info.MATERIAL_CODE.Length > 7)|| info.MATERIAL_CODE.Length>=14) |
|
|
|
|
|
{ |
|
|
|
|
|
string pbomcode = info.MATERIAL_CODE; |
|
|
|
|
|
List<ProcessRouteWorkCellSeq> list = workCelldal.GetFirstWorkCell(pbomcode); |
|
|
|
|
|
//左前、右前、左后、右后
|
|
|
|
|
|
for (int i = 0; i < info.QTY; i++) |
|
|
|
|
|
{ |
|
|
|
|
|
DataRow workOrder = workOrderDt.NewRow(); |
|
|
|
|
|
|
|
|
|
|
|
workOrder["PID"] = Guid.NewGuid().ToString(); |
|
|
|
|
|
workOrder["ORDERPLANID"] = info.PID; |
|
|
|
|
|
workOrder["ORDERPLAN_NO"] = (info.PLAN_NO.ToString() + (i + 1).ToString().PadLeft(4, '0')); |
|
|
|
|
|
workOrder["ORDER_TYPE"] = info.PLANSOURCE; |
|
|
|
|
|
workOrder["SEQ"] = (i + 1).ToString().PadLeft(6, '0'); |
|
|
|
|
|
if (info.PLANSOURCE == EnumGeter.WORKORDERTYPE.INSERT.GetHashCode().ToString()) |
|
|
|
|
|
{ |
|
|
|
|
|
workOrder["SEQ"] = info.PLAN_SEQ + (i + 1).ToString().PadLeft(3, '0'); |
|
|
|
|
|
} |
|
|
|
|
|
workOrder["MATERIAL_CODE"] = info.MATERIAL_CODE; |
|
|
|
|
|
workOrder["PBOM_CODE"] = info.MATERIAL_CODE; |
|
|
|
|
|
workOrder["QTY"] = 1; |
|
|
|
|
|
workOrder["COMPLETE_QTY"] = 0; |
|
|
|
|
|
workOrder["PLAN_DATE"] = info.PLAN_DATE; |
|
|
|
|
|
workOrder["SHIFT_CODE"] = info.SHIFT_CODE; |
|
|
|
|
|
workOrder["WORKCENTER_CODE"] = info.WORKCENTER_CODE; |
|
|
|
|
|
workOrder["WORKCELL_CODE"] = "PREPARE1"; |
|
|
|
|
|
workOrder["WORKLOC_CODE"] = ""; |
|
|
|
|
|
workOrder["REMARK"] = ""; |
|
|
|
|
|
workOrder["EQPT_NAME"] = ""; |
|
|
|
|
|
workOrder["EQPT_CODE"] = ""; |
|
|
|
|
|
workOrder["STATE"] = EnumGeter.WORKPLANSTATE.INIT.GetHashCode().ToString(); |
|
|
|
|
|
workOrder["PRI"] = dicPRI.GetDictValue(info.PLANSOURCE); |
|
|
|
|
|
|
|
|
|
|
|
workOrderDt.Rows.Add(workOrder); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
//左侧、右侧 或 四个门一起打印
|
|
|
|
|
|
var list2 = "".Split(','); |
|
|
|
|
|
var dal = new TJDoorPlankPlanDAL(); |
|
|
|
|
|
var MachineList = dal.GetListMachine(info.MATERIAL_CODE); |
|
|
|
|
|
if (info.MATERIAL_CODE.Substring(info.MATERIAL_CODE.Length - 1, 1) == "L") |
|
|
|
|
|
{ |
|
|
|
|
|
list2 = "FL,RL".Split(','); |
|
|
|
|
|
} |
|
|
|
|
|
else if (info.MATERIAL_CODE.Substring(info.MATERIAL_CODE.Length - 1, 1) == "R") |
|
|
|
|
|
{ |
|
|
|
|
|
list2 = "FR,RR".Split(','); |
|
|
|
|
|
} |
|
|
|
|
|
else if ((info.MATERIAL_CODE.Length == 6 && info.MATERIAL_CODE.Substring(0,3) == "770")|| (info.MATERIAL_CODE.Length == 8 && info.MATERIAL_CODE.Substring(0, 4) == "018D")) |
|
|
|
|
|
{ |
|
|
|
|
|
list2 = "FL,RL,FR,RR".Split(','); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < info.QTY; i++) |
|
|
|
|
|
{ |
|
|
|
|
|
foreach (var seq in list2) |
|
|
|
|
|
{ |
|
|
|
|
|
DataRow workOrder = workOrderDt.NewRow(); |
|
|
|
|
|
|
|
|
|
|
|
workOrder["PID"] = Guid.NewGuid().ToString(); |
|
|
|
|
|
workOrder["ORDERPLANID"] = info.PID; |
|
|
|
|
|
workOrder["ORDERPLAN_NO"] = (info.PLAN_NO.ToString() + (i + 1).ToString().PadLeft(4, '0')); |
|
|
|
|
|
workOrder["ORDER_TYPE"] = info.PLANSOURCE; |
|
|
|
|
|
workOrder["SEQ"] = (i + 1).ToString().PadLeft(6, '0'); |
|
|
|
|
|
if (info.PLANSOURCE == EnumGeter.WORKORDERTYPE.INSERT.GetHashCode().ToString()) |
|
|
|
|
|
{ |
|
|
|
|
|
workOrder["SEQ"] = info.PLAN_SEQ + (i + 1).ToString().PadLeft(3, '0'); |
|
|
|
|
|
} |
|
|
|
|
|
//var BOMCODE = "";
|
|
|
|
|
|
|
|
|
|
|
|
//if (info.MATERIAL_CODE.Substring(0, 4) == "018D")
|
|
|
|
|
|
//{
|
|
|
|
|
|
// if (info.MATERIAL_CODE.Substring(info.MATERIAL_CODE.Length - 1, 1) == "L" || info.MATERIAL_CODE.Substring(info.MATERIAL_CODE.Length - 1, 1) == "R")
|
|
|
|
|
|
// {
|
|
|
|
|
|
// workOrder["MATERIAL_CODE"] = info.MATERIAL_CODE.Substring(0, info.MATERIAL_CODE.Length - 1) + seq;
|
|
|
|
|
|
// BOMCODE = info.MATERIAL_CODE.Substring(0, info.MATERIAL_CODE.Length - 1) + seq;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// else
|
|
|
|
|
|
// {
|
|
|
|
|
|
// workOrder["MATERIAL_CODE"] = info.MATERIAL_CODE + "-" + seq;
|
|
|
|
|
|
// BOMCODE = info.MATERIAL_CODE + "-" + seq;
|
|
|
|
|
|
// }
|
|
|
|
|
|
//}
|
|
|
|
|
|
//else if (info.MATERIAL_CODE.Substring(0, 3) == "770")
|
|
|
|
|
|
//{
|
|
|
|
|
|
// if (info.MATERIAL_CODE.Substring(info.MATERIAL_CODE.Length - 1, 1) == "L" || info.MATERIAL_CODE.Substring(info.MATERIAL_CODE.Length - 1, 1) == "R")
|
|
|
|
|
|
// {
|
|
|
|
|
|
// workOrder["MATERIAL_CODE"] = info.MATERIAL_CODE.Substring(0, info.MATERIAL_CODE.Length - 1) + seq;
|
|
|
|
|
|
// BOMCODE = info.MATERIAL_CODE.Substring(0, info.MATERIAL_CODE.Length - 1) + seq;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// else
|
|
|
|
|
|
// {
|
|
|
|
|
|
// workOrder["MATERIAL_CODE"] = info.MATERIAL_CODE + seq;
|
|
|
|
|
|
// BOMCODE = info.MATERIAL_CODE + seq;
|
|
|
|
|
|
// }
|
|
|
|
|
|
//}
|
|
|
|
|
|
//else
|
|
|
|
|
|
//{
|
|
|
|
|
|
// workOrder["MATERIAL_CODE"] = info.MATERIAL_CODE;
|
|
|
|
|
|
// BOMCODE = info.MATERIAL_CODE;
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
var WEIZHI = ""; |
|
|
|
|
|
switch (seq) |
|
|
|
|
|
{ |
|
|
|
|
|
case "LF": |
|
|
|
|
|
WEIZHI = "左前"; |
|
|
|
|
|
break; |
|
|
|
|
|
case "FL": |
|
|
|
|
|
WEIZHI = "左前"; |
|
|
|
|
|
break; |
|
|
|
|
|
case "LR": |
|
|
|
|
|
WEIZHI = "左后"; |
|
|
|
|
|
break; |
|
|
|
|
|
case "RL": |
|
|
|
|
|
WEIZHI = "左后"; |
|
|
|
|
|
break; |
|
|
|
|
|
case "RF": |
|
|
|
|
|
WEIZHI = "右前"; |
|
|
|
|
|
break; |
|
|
|
|
|
case "FR": |
|
|
|
|
|
WEIZHI = "右前"; |
|
|
|
|
|
break; |
|
|
|
|
|
case "RR": |
|
|
|
|
|
WEIZHI = "右后"; |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var Machine = MachineList.Where(p => p.MATERIALNAME.Contains(WEIZHI)).ToList(); |
|
|
|
|
|
if (Machine != null && Machine.Count > 0) |
|
|
|
|
|
{ |
|
|
|
|
|
workOrder["MATERIAL_CODE"] = Machine[0].MATERIALNO; |
|
|
|
|
|
workOrder["PBOM_CODE"] = Machine[0].MATERIALNO; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
workOrder["PBOM_CODE"] = ""; |
|
|
|
|
|
workOrder["MATERIAL_CODE"] = ""; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
workOrder["QTY"] = 1; |
|
|
|
|
|
workOrder["COMPLETE_QTY"] = 0; |
|
|
|
|
|
workOrder["PLAN_DATE"] = info.PLAN_DATE; |
|
|
|
|
|
workOrder["SHIFT_CODE"] = info.SHIFT_CODE; |
|
|
|
|
|
workOrder["WORKCENTER_CODE"] = info.WORKCENTER_CODE; |
|
|
|
|
|
workOrder["WORKCELL_CODE"] = "PREPARE1"; |
|
|
|
|
|
workOrder["WORKLOC_CODE"] = ""; |
|
|
|
|
|
workOrder["REMARK"] = ""; |
|
|
|
|
|
workOrder["EQPT_NAME"] = ""; |
|
|
|
|
|
workOrder["EQPT_CODE"] = ""; |
|
|
|
|
|
workOrder["STATE"] = EnumGeter.WORKPLANSTATE.INIT.GetHashCode().ToString(); |
|
|
|
|
|
workOrder["PRI"] = dicPRI.GetDictValue(info.PLANSOURCE); |
|
|
|
|
|
|
|
|
|
|
|
workOrderDt.Rows.Add(workOrder); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//注入派工单信息
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return workOrderDt; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public List<WorkOrder> TJPutOutOrderPlan(OrderPlan info, int number, int lastIndex) |
|
|
|
|
|
{ |
|
|
|
|
|
List<WorkOrder> wolist = new List<WorkOrder>(); |
|
|
|
|
|
WorkCellDAL workCelldal = new WorkCellDAL(); |
|
|
|
|
|
string pbomcode = info.PBOM_CODE; |
|
|
|
|
|
List<QMAPP.MD.Entity.ProcessRouteWorkCellSeq> list = workCelldal.GetFirstWorkCell(pbomcode); |
|
|
|
|
|
var dicPRI = new DictManageBLL(Dict.DictKind.ORDERPRI); |
|
|
|
|
|
|
|
|
|
|
|
//注入派工单信息
|
|
|
|
|
|
for (int i = 0; i < number; i++) |
|
|
|
|
|
{ |
|
|
|
|
|
foreach (var seq in list) |
|
|
|
|
|
{ |
|
|
|
|
|
WorkOrder wo = new WorkOrder(); |
|
|
|
|
|
wo.PID = Guid.NewGuid().ToString(); |
|
|
|
|
|
wo.ORDERPLANID = info.PID; |
|
|
|
|
|
wo.ORDERPLAN_NO = (info.PLAN_NO.ToString() + (i + 1 + lastIndex).ToString().PadLeft(4, '0')); |
|
|
|
|
|
wo.ORDER_TYPE = info.PLANSOURCE; |
|
|
|
|
|
wo.SEQ = (i + 1 + lastIndex).ToString().PadLeft(6, '0'); |
|
|
|
|
|
wo.MATERIAL_CODE = info.MATERIAL_CODE; |
|
|
|
|
|
wo.PBOM_CODE = info.PBOM_CODE; |
|
|
|
|
|
wo.QTY = 1; |
|
|
|
|
|
wo.COMPLETE_QTY = 0; |
|
|
|
|
|
wo.PLAN_DATE = info.PLAN_DATE; |
|
|
|
|
|
wo.SHIFT_CODE = info.SHIFT_CODE; |
|
|
|
|
|
wo.WORKCENTER_CODE = info.WORKCENTER_CODE; |
|
|
|
|
|
wo.WORKCELL_CODE = seq.WORKCELL_CODE; |
|
|
|
|
|
wo.WORKLOC_CODE = ""; |
|
|
|
|
|
wo.REMARK = ""; |
|
|
|
|
|
wo.EQPT_NAME = ""; |
|
|
|
|
|
wo.EQPT_CODE = ""; |
|
|
|
|
|
wo.STATE = Convert.ToInt32(EnumGeter.WORKPLANSTATE.INIT.GetHashCode().ToString()); |
|
|
|
|
|
wo.PRI = Convert.ToInt32(dicPRI.GetDictValue(info.PLANSOURCE)); |
|
|
|
|
|
wo.PRINTED = "0"; |
|
|
|
|
|
wolist.Add(wo); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return wolist; |
|
|
|
|
|
} |
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
#region 导出数据
|
|
|
#region 导出数据
|
|
|
/// <summary>
|
|
|
/// <summary>
|
|
|
/// 获取导出的数据
|
|
|
/// 获取导出的数据
|
|
|