using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Web; using WebAPI.Models; namespace WebAPI.Service { public class LuBaoSevice { /// /// 工序汇报扫码方法 /// public static ApiResult GetHbarCodeDetail(string sBillBarCode) { if (string.IsNullOrEmpty(sBillBarCode)) return new ApiResult { code = -1, msg = "条码不能为空" }; sBillBarCode = sBillBarCode.CompareTo("#") > 0 ? sBillBarCode.Split(Convert.ToChar("#"))[0] : sBillBarCode; var dataSet = GetBarCodeDb(sBillBarCode); if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) return new ApiResult { code = -1, msg = "不存在派工单号" }; return new ApiResult { code = 1, msg = "查询成功", data = dataSet }; } public static DataSet GetBarCodeDb(string billBarCode) { SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_ProcessSendWorkList where HBillType='3712' and 单据号= '" + billBarCode + "'", "h_v_Sc_ProcessSendWorkList"); return dataSet; } /// /// 委外工序汇报扫码方法 /// public static ApiResult WWGetHbarCodeDetail(string sBillBarCode) { if (string.IsNullOrEmpty(sBillBarCode)) return new ApiResult { code = -1, msg = "条码不能为空" }; sBillBarCode = sBillBarCode.CompareTo("#") > 0 ? sBillBarCode.Split(Convert.ToChar("#"))[0] : sBillBarCode; var dataSet = WWGetBarCodeDb(sBillBarCode); if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) return new ApiResult { code = -1, msg = "不存在委外派工单号" }; return new ApiResult { code = 1, msg = "查询成功", data = dataSet }; } public static DataSet WWGetBarCodeDb(string billBarCode) { SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); var dataSet = oCN.RunProcReturn("select top 1 * from h_v_WW_EntrustProcSendWorkBillList where HBillType='3740' and 单据号= '" + billBarCode + "'", "h_v_WW_EntrustProcSendWorkBillList"); return dataSet; } /// /// PDA汇报单回车方法 /// public static ApiResult GetProcDetail(string sBillNo, string sProcNo) { if (string.IsNullOrEmpty(sBillNo) || string.IsNullOrEmpty(sProcNo)) return new ApiResult { code = -1, msg = "条码和流转卡不能为空" }; var dataSet = GetProcDb(sBillNo, sProcNo); if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) return new ApiResult { code = -1, msg = "流水号或流转卡号为空" }; return new ApiResult { code = 1, msg = "查询成功", data = dataSet }; } public static DataSet GetProcDb(string sBillNo, string sProcNo) { SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Sc_ProcessSendWorkList where HBillType='3712' and 单据号= '" + sBillNo + "' and HprocID='" + sProcNo + "'", "h_v_Sc_ProcessSendWorkList"); return dataSet; } /// /// PDA委外汇报单回车方法 /// public static ApiResult WWGetProcDetail(string sBillNo, string sProcNo) { if (string.IsNullOrEmpty(sBillNo) || string.IsNullOrEmpty(sProcNo)) return new ApiResult { code = -1, msg = "条码和流转卡不能为空" }; var dataSet = WWGetProcDb(sBillNo, sProcNo); if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) return new ApiResult { code = -1, msg = "流水号或流转卡号为空" }; return new ApiResult { code = 1, msg = "查询成功", data = dataSet }; } public static DataSet WWGetProcDb(string sBillNo, string sProcNo) { SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); var dataSet = oCN.RunProcReturn("select top 1 * from h_v_WW_EntrustProcSendWorkBillList where HBillType='3740' and 单据号= '" + sBillNo + "' and HprocID='" + sProcNo + "'", "h_v_WW_EntrustProcSendWorkBillList"); return dataSet; } /// /// 检验方案根据id获取信息 /// public static ApiResult GetCheckProjectDetail(string HID) { if (string.IsNullOrEmpty(HID)) return new ApiResult { code = -1, msg = "ID不能为空" }; var dataSet = GetProjectDb(HID); if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) return new ApiResult { code = -1, msg = "不存在检验单号" }; return new ApiResult { code = 1, msg = "查询成功", data = dataSet }; } public static DataSet GetProjectDb(string HID) { SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Gy_Edit_QCCheckProjectList where hmainid= " + HID +" ", "h_v_Gy_Edit_QCCheckProjectList"); return dataSet; } /// /// 来料检验根据id获取信息 /// public static ApiResult GetPOStockInCheckBillDetail(string HID) { if (string.IsNullOrEmpty(HID)) return new ApiResult { code = -1, msg = "ID不能为空" }; var dataSet = GetPOStockInDb(HID); if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) return new ApiResult { code = -1, msg = "不存在来料检验单号" }; return new ApiResult { code = 1, msg = "查询成功", data = dataSet }; } public static DataSet GetPOStockInDb(string HID) { SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); var dataSet = oCN.RunProcReturn("select top 1 * from h_v_QC_Edit_POStockInCheckBillList where hmainid= " + HID + " ", "h_v_QC_Edit_POStockInCheckBillList"); return dataSet; } /// /// 首料检验根据id获取信息 /// public static ApiResult GetQC_FirstPieceCheckBillDetail(string HID) { if (string.IsNullOrEmpty(HID)) return new ApiResult { code = -1, msg = "ID不能为空" }; var dataSet = GetFirstPieceCheckDb(HID); if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) return new ApiResult { code = -1, msg = "不存在首料检验单号" }; return new ApiResult { code = 1, msg = "查询成功", data = dataSet }; } public static DataSet GetFirstPieceCheckDb(string HID) { SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); var dataSet = oCN.RunProcReturn("select top 1 * from h_v_QC_Edit_FirstPieceCheckBillList where hmainid= " + HID + " ", "h_v_QC_Edit_FirstPieceCheckBillList"); return dataSet; } /// /// 巡检单根据id获取信息 /// public static ApiResult GetQC_PatrolProcCheckBillDetail(string HID) { if (string.IsNullOrEmpty(HID)) return new ApiResult { code = -1, msg = "ID不能为空" }; var dataSet = GetPatrolProcCheckDb(HID); if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) return new ApiResult { code = -1, msg = "不存在巡检单号" }; return new ApiResult { code = 1, msg = "查询成功", data = dataSet }; } public static DataSet GetPatrolProcCheckDb(string HID) { SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); var dataSet = oCN.RunProcReturn("select top 1 * from h_v_QC_Edit_PatrolProcCheckBillList where hmainid= " + HID + " ", "h_v_QC_Edit_PatrolProcCheckBillList"); return dataSet; } /// /// 不良原因根据id获取信息 /// public static ApiResult GetGy_BadReasonBillDetail(string HID) { if (string.IsNullOrEmpty(HID)) return new ApiResult { code = -1, msg = "ID不能为空" }; var dataSet = GetGy_BadReasonDb(HID); if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) return new ApiResult { code = -1, msg = "不存在不良原因数据" }; return new ApiResult { code = 1, msg = "查询成功", data = dataSet }; } public static DataSet GetGy_BadReasonDb(string HID) { SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); var dataSet = oCN.RunProcReturn("select top 1 * from h_v_IF_Edit_BadReasonList where HItemID= " + HID + " ", "h_v_IF_Edit_BadReasonList"); return dataSet; } /// /// 计量单位根据id获取信息 /// public static ApiResult GetGy_UnitBillDetail(string HID) { if (string.IsNullOrEmpty(HID)) return new ApiResult { code = -1, msg = "ID不能为空" }; var dataSet = GetGy_UnitDb(HID); if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) return new ApiResult { code = -1, msg = "不存在计量单位数据" }; return new ApiResult { code = 1, msg = "查询成功", data = dataSet }; } public static DataSet GetGy_UnitDb(string HID) { SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Edit_Gy_UnitList where HItemID= " + HID + " ", "h_v_Edit_Gy_UnitList"); return dataSet; } /// /// 货币设置根据id获取信息 /// public static ApiResult GetGy_CurrencyBillDetail(string HID) { if (string.IsNullOrEmpty(HID)) return new ApiResult { code = -1, msg = "ID不能为空" }; var dataSet = GetGy_CurrencyDb(HID); if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) return new ApiResult { code = -1, msg = "不存在货币设置数据" }; return new ApiResult { code = 1, msg = "查询成功", data = dataSet }; } public static DataSet GetGy_CurrencyDb(string HID) { SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Edit_Gy_CurrencyList where HItemID= " + HID + " ", "h_v_Edit_Gy_CurrencyList"); return dataSet; } /// /// 生产资源根据id获取信息 /// public static ApiResult GetGy_SourceBillDetail(string HID) { if (string.IsNullOrEmpty(HID)) return new ApiResult { code = -1, msg = "ID不能为空" }; var dataSet = GetGy_SourceDb(HID); if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) return new ApiResult { code = -1, msg = "不存在生产资源数据" }; return new ApiResult { code = 1, msg = "查询成功", data = dataSet }; } public static DataSet GetGy_SourceDb(string HID) { SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Edit_IF_SourceList where HItemID= " + HID + " ", "h_v_Edit_IF_SourceList"); return dataSet; } /// /// 职员设置根据id获取信息 /// public static ApiResult GetGy_EmployeeBillDetail(string HID) { if (string.IsNullOrEmpty(HID)) return new ApiResult { code = -1, msg = "ID不能为空" }; var dataSet = GetGy_EmployeeDb(HID); if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) return new ApiResult { code = -1, msg = "不存在职员设置数据" }; return new ApiResult { code = 1, msg = "查询成功", data = dataSet }; } public static DataSet GetGy_EmployeeDb(string HID) { SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Edit_IF_EmployeeList where HItemID= " + HID + " ", "h_v_Edit_IF_EmployeeList"); return dataSet; } /// /// 物料设置根据id获取信息 /// public static ApiResult GetGy_MaterialBillDetail(string HID) { if (string.IsNullOrEmpty(HID)) return new ApiResult { code = -1, msg = "ID不能为空" }; var dataSet = Gy_MaterialDb(HID); if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) return new ApiResult { code = -1, msg = "不存在此物料数据" }; return new ApiResult { code = 1, msg = "查询成功", data = dataSet }; } public static DataSet Gy_MaterialDb(string HID) { SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); var dataSet = oCN.RunProcReturn("select top 1 * from h_v_Edit_Gy_MaterialList where HItemID= " + HID + " ", "h_v_Edit_Gy_MaterialList"); return dataSet; } } }