| | |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static ApiResult<DocumentsView> GetInterBillNo(string billType) |
| | | { |
| | | var hInterId= DBUtility.ClsPub.CreateBillID(billType, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | var hBillNo= DBUtility.ClsPub.CreateBillCode(billType, ref DBUtility.ClsPub.sExeReturnInfo, true); |
| | | { |
| | | var hInterId = DBUtility.ClsPub.CreateBillID(billType, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | var hBillNo = DBUtility.ClsPub.CreateBillCode(billType, ref DBUtility.ClsPub.sExeReturnInfo, true); |
| | | if (hInterId == 0 || string.IsNullOrEmpty(hBillNo)) |
| | | return new ApiResult<DocumentsView> { code = -1, msg = "获取失败" }; |
| | | DocumentsView documentsView = new DocumentsView() |
| | |
| | | var dataSet = GetBarCodeDb(sBillBarCode); |
| | | if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) |
| | | return new ApiResult<DataSet> { code = -1, msg = "不存在流转卡号" }; |
| | | return new ApiResult<DataSet> { code = 1, msg = "查询成功",data=dataSet }; |
| | | return new ApiResult<DataSet> { code = 1, msg = "查询成功", data = dataSet }; |
| | | } |
| | | /// <summary> |
| | | /// 流转卡回车方法 |
| | | /// </summary> |
| | | public static ApiResult<DataSet> GetProcDetail(string sBillNo, string sProcNo) |
| | | { |
| | | if (string.IsNullOrEmpty(sBillNo)||string.IsNullOrEmpty(sProcNo)) |
| | | if (string.IsNullOrEmpty(sBillNo) || string.IsNullOrEmpty(sProcNo)) |
| | | return new ApiResult<DataSet> { code = -1, msg = "条码和流转卡不能为空" }; |
| | | var dataSet = GetProcDb(sBillNo, sProcNo); |
| | | if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) |
| | |
| | | return new ApiResult { code = -1, msg = "服务器繁忙" }; |
| | | try |
| | | { |
| | | if (oMain.HProcID == 0 || oMain.HQty == 0 ||string.IsNullOrEmpty(oMain.HProcExchBillNo)||oMain.HQty==0||string.IsNullOrEmpty(oMain.HBillNo)) |
| | | if (oMain.HProcID == 0 || oMain.HQty == 0 || string.IsNullOrEmpty(oMain.HProcExchBillNo) || oMain.HQty == 0 || string.IsNullOrEmpty(oMain.HBillNo)) |
| | | return new ApiResult { code = 1, msg = "参数不全" }; |
| | | var stationInList = YqnDal.GetStationInBillMailList(oMain.HICMOBillNo);//获得该流转卡所有进站单 |
| | | var stationInList = YqnDal.GetStationInBillMailList(oMain.HProcExchBillNo);//获得该流转卡所有进站单 |
| | | if (stationInList.Count > 0) |
| | | { |
| | | var stationOutList = YqnDal.GetStationOutBillMailList(oMain.HICMOBillNo);//获得该流转卡所有出站单 |
| | | var stationOutList = YqnDal.GetStationOutBillMailList(oMain.HProcExchBillNo);//获得该流转卡所有出站单 |
| | | var stationInModel = stationInList.OrderByDescending(a => a.HDate).First();//获取进站单最新进站工序 |
| | | if (stationOutList.Count == 0 && oMain.HProcID == stationInModel.HProcID) |
| | | return new ApiResult { code = -1, msg = "重复扫描" }; |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return new ApiResult { code = -1, msg = "请求错误"+ex.ToString() }; |
| | | return new ApiResult { code = -1, msg = "请求错误" + ex.ToString() }; |
| | | } |
| | | finally |
| | | { |
| | |
| | | return new ApiResult<DataSet> { code = 1, msg = "查询成功", data = dataSet }; |
| | | } |
| | | /// <summary> |
| | | /// 获取不良仓库列表 |
| | | /// </summary> |
| | | /// <param name="sWhere"></param> |
| | | /// <returns></returns> |
| | | public static ApiResult<DataSet> GetBadWHList(string sWhere) |
| | | { |
| | | var dataSet = GetBadWH(sWhere); |
| | | if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) |
| | | return new ApiResult<DataSet> { code = -1, msg = "未查询到不良仓库" }; |
| | | return new ApiResult<DataSet> { code = 1, msg = "查询成功", data = dataSet }; |
| | | } |
| | | /// <summary> |
| | | /// 获取报废仓库列表 |
| | | /// </summary> |
| | | /// <param name="sWhere"></param> |
| | | /// <returns></returns> |
| | | public static ApiResult<DataSet> GetWasterWHList(string sWhere) |
| | | { |
| | | var dataSet = GetWasterWH(sWhere); |
| | | if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) |
| | | return new ApiResult<DataSet> { code = -1, msg = "未查询到报废仓库" }; |
| | | return new ApiResult<DataSet> { code = 1, msg = "查询成功", data = dataSet }; |
| | | } |
| | | /// <summary> |
| | | /// 获取研发不良品仓库列表 |
| | | /// </summary> |
| | | /// <param name="sWhere"></param> |
| | | /// <returns></returns> |
| | | public static ApiResult<DataSet> GetBadCountDevelopWHList(string sWhere) |
| | | { |
| | | var dataSet = GetBadCountDevelopWH(sWhere); |
| | | if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) |
| | | return new ApiResult<DataSet> { code = -1, msg = "未查询到研发不良品仓库" }; |
| | | return new ApiResult<DataSet> { code = 1, msg = "查询成功", data = dataSet }; |
| | | } |
| | | /// <summary> |
| | | /// 获取委外不良仓库列表 |
| | | /// </summary> |
| | | /// <param name="sWhere"></param> |
| | | /// <returns></returns> |
| | | public static ApiResult<DataSet> GetWWBadWHList(string sWhere) |
| | | { |
| | | var dataSet = GetWWBadWH(sWhere); |
| | | if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) |
| | | return new ApiResult<DataSet> { code = -1, msg = "未查询到委外不良仓库" }; |
| | | return new ApiResult<DataSet> { code = 1, msg = "查询成功", data = dataSet }; |
| | | } |
| | | /// <summary> |
| | | /// 获取委外报废仓库列表 |
| | | /// </summary> |
| | | /// <param name="sWhere"></param> |
| | | /// <returns></returns> |
| | | public static ApiResult<DataSet> GetWWWasterWHList(string sWhere) |
| | | { |
| | | var dataSet = GetWWWasterWH(sWhere); |
| | | if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) |
| | | return new ApiResult<DataSet> { code = -1, msg = "未查询到委外报废仓库" }; |
| | | return new ApiResult<DataSet> { code = 1, msg = "查询成功", data = dataSet }; |
| | | } |
| | | /// <summary> |
| | | /// 获取良品仓库列表 |
| | | /// </summary> |
| | | /// <param name="sWhere"></param> |
| | | /// <returns></returns> |
| | | public static ApiResult<DataSet> GetWHList(string sWhere) |
| | | { |
| | | var dataSet = GetWH(sWhere); |
| | | if (dataSet == null || dataSet.Tables[0].Rows.Count == 0) |
| | | return new ApiResult<DataSet> { code = -1, msg = "未查询到良品仓库" }; |
| | | return new ApiResult<DataSet> { code = 1, msg = "查询成功", data = dataSet }; |
| | | } |
| | | /// <summary> |
| | | /// 获取流转卡列表 |
| | | /// </summary> |
| | | /// <param name="sWhere"></param> |
| | |
| | | /// </summary> |
| | | public static ApiResult SetStationOutBill(StationOutBillView omodel) |
| | | { |
| | | if (!dicLock.TryAdd(omodel.HBillNo, omodel.HBillNo))//同一单号并发处理 |
| | | if (!dicLock.TryAdd(omodel.HICMOBillNo + "cz", omodel.HBillNo))//同一单号并发处理 |
| | | return new ApiResult { code = -1, msg = "服务器繁忙" }; |
| | | var stationInBillModel = YqnDal.GetStationInBillMail(omodel.HProcID, omodel.HICMOBillNo); |
| | | if (stationInBillModel == null) |
| | | return new ApiResult { code = -1, msg = "该工序进站单不存在" }; |
| | | var stationOutBillModel = YqnDal.GetStationOutBillMail(omodel.HProcID, omodel.HICMOBillNo); |
| | | if (stationOutBillModel != null) |
| | | return new ApiResult { code = -1, msg = "该工序已存在出站单" }; |
| | | omodel.HYear = DateTime.Now.Year; |
| | | var result = SetOutBill(omodel); |
| | | return result; |
| | | try |
| | | { |
| | | var stationInBillModel = YqnDal.GetStationInBillMail(omodel.HProcID, omodel.HProcExchBillNo); |
| | | if (stationInBillModel == null) |
| | | return new ApiResult { code = -1, msg = "该工序进站单不存在" }; |
| | | var stationOutBillModel = YqnDal.GetStationOutBillMail(omodel.HProcID, omodel.HProcExchBillNo); |
| | | if (stationOutBillModel != null) |
| | | return new ApiResult { code = -1, msg = "该工序已存在出站单" }; |
| | | omodel.HYear = DateTime.Now.Year; |
| | | var result = SetOutBill(omodel); |
| | | return result; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return new ApiResult { code = -1, msg = ex.ToString() }; |
| | | } |
| | | finally |
| | | { |
| | | dicLock.TryRemove(omodel.HICMOBillNo + "cz", out string key); |
| | | } |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 获取工序详情 |
| | | /// </summary> |
| | | /// <param name="hItemId"></param> |
| | | /// <returns></returns> |
| | | public static ApiResult<Models.M_Process> GetProcessDetail(int hItemId) |
| | | { |
| | | var processModel = ProcessDal.GetProcessDetail(hItemId); |
| | | if (processModel == null) |
| | | return new ApiResult<M_Process> { code = -1, msg = "查询为空" }; |
| | | processModel.DepartmentModel = ProcessDal.GetDepartmentModel(processModel.HDeptID); |
| | | processModel.ProcMulModel = ProcessDal.GetProcMulModel(processModel.HProcMulID); |
| | | return new ApiResult<M_Process> { code = 1, msg = "查询成功", data = processModel }; |
| | | } |
| | | /// <summary> |
| | | /// 获取工序列表 |
| | | /// </summary> |
| | | /// <param name="hName"></param> |
| | | /// <param name="hLevel"></param> |
| | | /// <param name="hNumber"></param> |
| | | /// <param name="hBillSubType"></param> |
| | | /// <returns></returns> |
| | | public static ApiResult<List<Models.M_Process>> GetProcessList(string hName, int hLevel, string hNumber, string hBillSubType, int page, int limit) |
| | | { |
| | | int pageCount = 0; |
| | | var list = ProcessDal.GetProcessList(hName, hLevel, hNumber, hBillSubType, page, limit, ref pageCount); |
| | | if (list?.Count == 0) |
| | | return new ApiResult<List<M_Process>> { code = -1, msg = "查询为空" }; |
| | | return new ApiResult<List<M_Process>> { code = 0, msg = "查询成功", data = list, count = pageCount }; |
| | | } |
| | | /// <summary> |
| | | /// 删除一条工序 |
| | | /// </summary> |
| | | /// <param name="hItemID"></param> |
| | | /// <returns></returns> |
| | | public static ApiResult DeleteProcess(int hItemID) |
| | | { |
| | | var result = ProcessDal.DeleteProcess(hItemID); |
| | | if (result > 0) |
| | | return new ApiResult { code = 1, msg = "删除成功" }; |
| | | return new ApiResult { code = -1, msg = "删除数据不存在" }; |
| | | } |
| | | #region sql语句 |
| | | public static DataSet GetStationOutBill(string strWhere) |
| | |
| | | var sql = "Select top 5000 * from h_v_MES_StationOutBillList Where 1=1 " + strWhere; |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | var dataSet = oCN.RunProcReturn(sql, "h_v_MES_StationOutBillList"); |
| | | return dataSet; |
| | | } |
| | | public static DataSet GetBadWH(string sWhere) |
| | | { |
| | | var sql = "Select * from h_v_Sc_GetBadWH Where 1=1 " + sWhere; |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | var dataSet = oCN.RunProcReturn(sql, "h_v_Sc_GetBadWH"); |
| | | return dataSet; |
| | | } |
| | | public static DataSet GetWasterWH(string sWhere) |
| | | { |
| | | var sql = "Select * from h_v_Sc_GetWasterWH Where 1=1 " + sWhere; |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | var dataSet = oCN.RunProcReturn(sql, "h_v_Sc_GetWasterWH"); |
| | | return dataSet; |
| | | } |
| | | public static DataSet GetBadCountDevelopWH(string sWhere) |
| | | { |
| | | var sql = "Select * from h_v_Sc_GetBadCountDevelopWH Where 1=1 " + sWhere; |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | var dataSet = oCN.RunProcReturn(sql, "h_v_Sc_GetBadCountDevelopWH"); |
| | | return dataSet; |
| | | } |
| | | public static DataSet GetWWBadWH(string sWhere) |
| | | { |
| | | var sql = "Select * from h_v_Sc_GetWWBadWH Where 1=1 " + sWhere; |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | var dataSet = oCN.RunProcReturn(sql, "h_v_Sc_GetWWBadWH"); |
| | | return dataSet; |
| | | } |
| | | public static DataSet GetWWWasterWH(string sWhere) |
| | | { |
| | | var sql = "Select * from h_v_Sc_GetWWWasterWH Where 1=1 " + sWhere; |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | var dataSet = oCN.RunProcReturn(sql, "h_v_Sc_GetWWWasterWH"); |
| | | return dataSet; |
| | | } |
| | | public static DataSet GetWH(string sWhere) |
| | | { |
| | | var sql = "Select * from h_v_Sc_GetWH Where 1=1 " + sWhere; |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | var dataSet = oCN.RunProcReturn(sql, "h_v_Sc_GetWH"); |
| | | return dataSet; |
| | | } |
| | | public static DataSet GetStationInBill(string strWhere) |
| | |
| | | { |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | omodel.HInterID = DBUtility.ClsPub.CreateBillID("3791", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | //oCN.BeginTran(); |
| | | oCN.BeginTran(); |
| | | var sql = "Insert Into Sc_StationOutBillMain " + |
| | | "(HBillType,HBillSubType,HInterID,HBillNo,HBillStatus,HDate,HMaker,HMakeDate" + |
| | | ",HYear,HPeriod,HRemark" + |
| | |
| | | "," + omodel.HICMOInterID.ToString() + ",'" + omodel.HICMOBillNo + "'," + omodel.HProcPlanInterID.ToString() + "," + omodel.HProcPlanEntryID.ToString() + ",'" + omodel.HProcPlanBillNo + "'," + omodel.HProcExchInterID.ToString() + "," + omodel.HProcExchEntryID.ToString() + |
| | | ",'" + omodel.HProcExchBillNo + "'," + omodel.HMaterID.ToString() + "," + omodel.HProcID.ToString() + "," + omodel.HICMOQty.ToString() + "," + omodel.HPlanQty.ToString() + ",getdate()," + omodel.HSourceID.ToString() + |
| | | "," + omodel.HGroupID.ToString() + "," + omodel.HDeptID.ToString() + "," + omodel.HEmpID.ToString() + ",'" + omodel.HBarCode + "','" + omodel.HAddr + "','" + omodel.HBarCodeMaker + "',getdate()" + |
| | | "," + omodel.HSupID.ToString() + "," + omodel.HQty.ToString() + "," + omodel.HPrice.ToString() + "," + omodel.HMoney.ToString() +"," + omodel.HProcNo + ") "; |
| | | "," + omodel.HSupID.ToString() + "," + omodel.HQty.ToString() + "," + omodel.HPrice.ToString() + "," + omodel.HMoney.ToString() + "," + omodel.HProcNo + ") "; |
| | | //var result= SqlPools.GetInstance("YqnConn").ExecuteCommand(sql); |
| | | oCN.RunProc(sql); |
| | | oCN.Commit(); |
| | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return new ApiResult { code = -1, msg = "保存错误/"+ex.ToString() }; |
| | | return new ApiResult { code = -1, msg = "保存错误/" + ex.ToString() }; |
| | | } |
| | | } |
| | | public static ApiResult SetInBill(ClsSc_StationInBillMain omodel) |