using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Reflection;
|
using System.Text;
|
using System.Threading.Tasks;
|
using System.Xml;
|
using Pcb.Common.Config;
|
using Pcb.Domain;
|
|
|
namespace Pcb.Common
|
{
|
/// <summary>
|
/// PCB生产帮助类
|
/// </summary>
|
public class PcbProductHeper
|
{
|
#region 工序是否允许过序列表
|
/// <summary>
|
/// 生产协同工厂流程中哪些工序允许过序列表:0,1,0,0,0,1,0 (0允许1不允许)
|
/// </summary>
|
/// <param name="StepKeys"></param>
|
/// <param name="JoinFactoryId"></param>
|
/// <returns></returns>
|
public static string GetIsFlowList(string StepKeys, int JoinFactoryId)
|
{
|
LogHelper.Info(StepKeys + ":" + JoinFactoryId);
|
if (!string.IsNullOrEmpty(StepKeys))
|
{
|
var keys = GetIsFlowList(StepKeys.Split(','), JoinFactoryId);
|
return keys;
|
}
|
return string.Empty;
|
}
|
/// <summary>
|
/// 生产协同工厂流程中哪些工序允许过序列表:0,1,0,0,0,1,0 (0允许1不允许)
|
/// </summary>
|
/// <param name="StepKeys"></param>
|
/// <param name="JoinFactoryId"></param>
|
/// <returns></returns>
|
public static string GetIsFlowList(IEnumerable<string> StepKeys, int JoinFactoryId)
|
{
|
if (JoinFactoryId == 0) { return string.Empty; }
|
|
var cfgs = PcbQutoConfigHeler.GetFactoryTypes();
|
var cfg = cfgs._GetValue("JoinFactory");
|
if (cfg == null) { return string.Empty; }
|
var value = cfg._GetValue(JoinFactoryId.ToString());
|
if (string.IsNullOrEmpty(value)) { return string.Empty; }
|
var allowkeys = value.Split(',')._ToHashSet(t => t);
|
|
var lstisflows = new List<int>();
|
foreach (var key in StepKeys)
|
{
|
if (string.IsNullOrEmpty(key)) { continue; }
|
lstisflows.Add(allowkeys.Contains(key) ? 0 : 1);
|
}
|
var isflows = string.Join(",", lstisflows);
|
return isflows;
|
}
|
#endregion
|
|
/// <summary>
|
/// 更新拼版信息(包括片数、面积等)
|
/// </summary>
|
/// <returns></returns>
|
public static List<ProOrder> CalcPinBanInfo(List<ProOrder> Models)
|
{
|
Models.ForEach(x =>
|
{
|
//x.Num = ControlCardManage.GetActualNum(x);
|
if (x.BoardType != "set")
|
{
|
int[] array = Array.ConvertAll(x.PinBanType.Split('x'), s => int.Parse(s));
|
int pinbannum = array[0] * array[1];
|
x.Num = Math.Ceiling(Convert.ToDecimal(x.Num) / Convert.ToDecimal(pinbannum)).ToInt2();
|
}
|
x.DeliveryDate = x.DeliveryDate.AddDays(-1);
|
|
if (x.OrderNo.Contains("ALL"))
|
{
|
x.OrderNoType = 2;
|
}
|
else
|
{
|
x.OrderNoType = 1;
|
}
|
if (x.DeliveryDays == 1 && x.OrderType == 2)
|
{
|
x.OrderType = 1;
|
}
|
if (x.BoardArea == null)
|
{
|
x.BoardArea = (x.BoardWidth * x.BoardHeight * x.Num / 1000000).ToDecimal2();
|
}
|
});
|
return Models;
|
}
|
|
}
|
}
|