You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
256 lines
9.7 KiB
256 lines
9.7 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
//Ref:
|
|
using System.Data;
|
|
|
|
using QMAPP.BoraUpgrade.DAL;
|
|
using QMAPP.BoraUpgrade.Entity;
|
|
|
|
namespace QMAPP.BoraUpgrade.BLL
|
|
{
|
|
public class WorkOrderBLL
|
|
{
|
|
/// <summary>
|
|
/// 获取全部宝来升级路由列表
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static T_MD_MATERIAL GetMaterialListByWorkOrderID(string workOrderID, string materialType)
|
|
{
|
|
T_MD_MATERIAL newMaterial = new T_MD_MATERIAL();
|
|
|
|
DataTable dataTable = QMAPP.BoraUpgrade.DAL.WorkOrderDAL.GetMaterialByWorkOrderID(workOrderID, materialType);
|
|
|
|
if (dataTable.Rows.Count != 0)
|
|
{
|
|
foreach (DataRow currRow in dataTable.Rows)
|
|
{
|
|
newMaterial.PID = currRow["PID"].ToString();
|
|
newMaterial.MATERIAL_CODE = currRow["MATERIAL_CODE"].ToString();
|
|
newMaterial.MATERIAL_TYPE_CODE = currRow["MATERIAL_TYPE_CODE"].ToString();
|
|
newMaterial.UNIT_CODE = currRow["UNIT_CODE"].ToString();
|
|
newMaterial.MATERIAL_NAME = currRow["MATERIAL_NAME"].ToString();
|
|
newMaterial.MATERIAL_COMP = currRow["MATERIAL_COMP"].ToString();
|
|
newMaterial.REMARK = currRow["REMARK"].ToString();
|
|
newMaterial.CREATEUSER = currRow["CREATEUSER"].ToString();
|
|
newMaterial.CREATEDATE = DateTime.Parse(currRow["CREATEDATE"].ToString());
|
|
newMaterial.UPDATEUSER = currRow["UPDATEUSER"].ToString();
|
|
newMaterial.UPDATEDATE = currRow["UPDATEDATE"].ToString();
|
|
newMaterial.OUTSOURCE = currRow["OUTSOURCE"].ToString();
|
|
newMaterial.STD_QTY = int.Parse(currRow["STD_QTY"].ToString());
|
|
newMaterial.FLGDEL = currRow["FLGDEL"].ToString();
|
|
newMaterial.COLOR = currRow["COLOR"].ToString();
|
|
newMaterial.HBTYPE = currRow["HBTYPE"].ToString();
|
|
newMaterial.PROJECTCODE = currRow["PROJECTCODE"].ToString();
|
|
|
|
if ( !string.IsNullOrWhiteSpace(currRow["WEIGHT"].ToString()) )
|
|
{
|
|
newMaterial.WEIGHT = int.Parse(currRow["WEIGHT"].ToString());
|
|
}
|
|
|
|
newMaterial.MATERIAL_SHORT = currRow["MATERIAL_SHORT"].ToString();
|
|
newMaterial.WORKBIN_TYPE = currRow["WORKBIN_TYPE"].ToString();
|
|
newMaterial.CAPACITY = int.Parse(currRow["CAPACITY"].ToString());
|
|
newMaterial.FACTORY_CODE = currRow["FACTORY_CODE"].ToString();
|
|
}
|
|
}
|
|
|
|
return newMaterial;
|
|
}
|
|
/// <summary>
|
|
/// 查询fis工单
|
|
/// </summary>
|
|
/// <param name="state">0:未处理 1:已打印BZD 2:已器具排序</param>
|
|
/// <returns></returns>
|
|
public static DataTable GetFisOrder(string lineCode,int state,int pQty = 1000)
|
|
{
|
|
return WorkOrderDAL.GetFisOrders(lineCode, state, pQty);
|
|
}
|
|
/// <summary>
|
|
/// 修改fis订单的状态
|
|
/// </summary>
|
|
/// <param name="orderNo"></param>
|
|
/// <param name="state"></param>
|
|
/// <returns></returns>
|
|
public static bool UpdateFisOrderState(string pOrderNo, string pBzdCode, int state)
|
|
{
|
|
return WorkOrderDAL.UpdateFisOrderState(pOrderNo, pBzdCode, state);
|
|
}
|
|
/// <summary>
|
|
/// 终检排序扫描记录的保存 T_AW_FinalSortRecord
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static bool SaveSacnOrderRecord(DataRow dataRow)
|
|
{
|
|
return WorkOrderDAL.SaveSacnOrderRecord(dataRow);
|
|
}
|
|
/// <summary>
|
|
/// A3车型,根据BZD条码获取物料号
|
|
/// </summary>
|
|
/// <param name="bzdCode"></param>
|
|
/// <returns></returns>
|
|
public static string GetA3MaterialCodeByBZD(string bzdCode)
|
|
{
|
|
return WorkOrderDAL.GetA3MaterialCodeByBZD(bzdCode);
|
|
}
|
|
|
|
/// <summary>
|
|
/// MPID码获取物料号
|
|
/// </summary>
|
|
/// <param name="bzdCode"></param>
|
|
/// <returns></returns>
|
|
public static string GetA3MaterialCodeByPID(string mpid)
|
|
{
|
|
return WorkOrderDAL.GetA3MaterialCodeByPID(mpid);
|
|
}
|
|
|
|
/// <summary>
|
|
/// BZD条码是否没有被使用
|
|
/// </summary>
|
|
/// <param name="pBzdCode"></param>
|
|
/// <returns></returns>
|
|
public static bool IsNoUsedBzdCode(string pBzdCode)
|
|
{
|
|
return WorkOrderDAL.IsNoUsedBzdCode(pBzdCode);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 宝来仪表板,根据本体码查询总成数据
|
|
/// </summary>
|
|
/// <param name="productCode"></param>
|
|
/// <returns></returns>
|
|
public static DataTable GetMainInfo(string productCode)
|
|
{
|
|
return WorkOrderDAL.GetMainInfo(productCode);
|
|
}
|
|
/// <summary>
|
|
/// 根据扫描的本体码查找生产产品的总成零件号
|
|
/// 适合倒数第二工位 ,在product表找最新生产记录的物料号. 然后在pbomitem表找到pbomcode. 最后在pbom表找到总成零件号
|
|
/// </summary>
|
|
/// <param name="productCode"></param>
|
|
/// <returns></returns>
|
|
public static string GetPMaterialCode(string productCode)
|
|
{
|
|
return WorkOrderDAL.GetPMaterialCode(productCode);
|
|
}
|
|
/// <summary>
|
|
/// 校验该本体条码在该工序是否生产完成
|
|
/// </summary>
|
|
/// <param name="productCode"></param>
|
|
/// <param name="lastCellCode"></param>
|
|
/// <returns></returns>
|
|
public static bool VerifyLastCellOver(string productCode,string lastCellCode)
|
|
{
|
|
return WorkOrderDAL.VerifyLastCellOver(productCode, lastCellCode);
|
|
}
|
|
public static bool IsBarCodeRepet(string productCode )
|
|
{
|
|
return WorkOrderDAL.IsBarCodeRepet(productCode);
|
|
}
|
|
/// <summary>
|
|
/// 查询计划编号
|
|
/// </summary>
|
|
/// <param name="productCode"></param>
|
|
/// <returns></returns>
|
|
public static string GetPlanCode(string productCode)
|
|
{
|
|
return WorkOrderDAL.GetPlanCode(productCode);
|
|
}
|
|
/// <summary>
|
|
/// 获取班次信息
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static List<FJC.Entity.Basic.ProduceShift> GetShiftList()
|
|
{
|
|
return WorkOrderDAL.GetShiftList();
|
|
}
|
|
public static string GetBoraBZDCode(string productCode, string materialCode)
|
|
{
|
|
return WorkOrderDAL.GetBoraBZDCode(productCode, materialCode);
|
|
}
|
|
public static string GetA3ProductCodeByBzd(string bzdCode)
|
|
{
|
|
return WorkOrderDAL.GetA3ProductCodeByBzd(bzdCode);
|
|
}
|
|
|
|
public static string GetA3ProductCreateByBzd(string bzdCode)
|
|
{
|
|
return WorkOrderDAL.GetA3ProductCreateByBzd(bzdCode);
|
|
}
|
|
public static string GetA3MpidCodeByBzd(string bzdCode)
|
|
{
|
|
return WorkOrderDAL.GetA3MpidCodeByBzd(bzdCode);
|
|
}
|
|
public static void SaveA3MainRecord( string[] basicData, string userID, string materialCode, string bzdCode, string productionCode,string lineCode)
|
|
{
|
|
WorkOrderDAL.SaveA3MainRecord(basicData, bzdCode, productionCode, userID, materialCode, lineCode);
|
|
}
|
|
public static DataTable GetStoreData(int count = 100)
|
|
{
|
|
return WorkOrderDAL.GetStoreData(count);
|
|
}
|
|
/// <summary>
|
|
/// 计划挂起
|
|
/// </summary>
|
|
public static void UpBills(List<DataRow> upRows)
|
|
{
|
|
|
|
List<DataRow> rows = upRows.Where(p => p.Field<int>("SendState") != 0).ToList();
|
|
if(rows.Count >0)
|
|
{
|
|
List<string> list = rows.Select(p => p.Field<string>("FisOrderNo")).ToList();
|
|
throw new Exception("挂起失败,因为编号为[" + string.Join(";", list) + "]的订单正在生产或发运状态中,不满足要求");
|
|
}
|
|
foreach(DataRow upRow in upRows)
|
|
{
|
|
WorkOrderDAL.UpdateFisSetState(upRow);
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// 查询每天早8:30到第二天8:30的产量
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static string GetDayYield()
|
|
{
|
|
return WorkOrderDAL.GetDayYield();
|
|
}
|
|
public static string GetA3DayYield()
|
|
{
|
|
return WorkOrderDAL.GetA3DayYield();
|
|
}
|
|
public static string GetBoraHDayYield()
|
|
{
|
|
return WorkOrderDAL.GetBoraHDayYield();
|
|
}
|
|
public static string GetBoraLDayYield()
|
|
{
|
|
return WorkOrderDAL.GetBoraLDayYield();
|
|
}
|
|
public static void UpBillsDispose(List<DataRow> upRows)
|
|
{
|
|
|
|
List<DataRow> rows = upRows.Where(p => p.Field<int>("SendState") != 9).ToList();
|
|
if (rows.Count > 0)
|
|
{
|
|
List<string> list = rows.Select(p => p.Field<string>("FisOrderNo")).ToList();
|
|
throw new Exception("取消挂起失败,因为编号为[" + string.Join(";", list) + "]的订单不属于挂起状态!");
|
|
}
|
|
//foreach (DataRow upRow in upRows)
|
|
//{
|
|
// WorkOrderDAL.UpdateFisSetStateDispose(upRow);
|
|
//}
|
|
WorkOrderDAL.UpdateFisSetStateDisposes(upRows);
|
|
}
|
|
|
|
public static void SaveStartIndex(int startIndex)
|
|
{
|
|
WorkOrderDAL.SaveStartIndex(startIndex);
|
|
}
|
|
public static int GetStartIndex()
|
|
{
|
|
return WorkOrderDAL.GetStartIndex();
|
|
}
|
|
}
|
|
}
|
|
|