| | |
| | | using Newtonsoft.Json.Linq; |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Linq; |
| | | using Pub_Class; |
| | | using System; |
| | | using System.Collections.Generic; |
| | |
| | | public DataSet ds = new DataSet(); |
| | | public WebServer webserver = new WebServer(); |
| | | public SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | public DAL.ClsSc_ICMOBill BillOld = new DAL.ClsSc_ICMOBill(); |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | |
| | | public DAL.ClsSc_MouldScrapInBill BillNew0 = new DAL.ClsSc_MouldScrapInBill(); //模具报废入库对应单据类 |
| | |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_MouldMaintainBillList", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | |
| | | |
| | | ds = Sc_MouldMaintainBillList_s(sWhere); |
| | | |
| | | //添加列名 |
| | | foreach (DataColumn col in ds.Tables[0].Columns) |
| | | { |
| | | Type dataType = col.DataType; |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; |
| | | columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 |
| | | } |
| | | //if (ds.Tables[0].Rows.Count != 0 || ds != null) |
| | | //{ |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = columnNameList; |
| | | return objJsonResult; |
| | | //} |
| | | //else |
| | |
| | | |
| | | ds = Sc_MouldDotCheckPlanBillList_s(sWhere); |
| | | |
| | | //if (ds.Tables[0].Rows.Count != 0 || ds != null) |
| | | //{ |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | //} |
| | | //else |
| | | //{ |
| | | //objJsonResult.code = "0"; |
| | | //objJsonResult.count = 0; |
| | | //objJsonResult.Message = "无数据"; |
| | | //objJsonResult.data = null; |
| | | //return objJsonResult; |
| | | //} |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_MouldDotCheckBillList", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | |
| | | } |
| | | ds = Sc_MouldDotCheckBillList_s(sWhere); |
| | | |
| | | //if (ds.Tables[0].Rows.Count != 0 || ds != null) |
| | | //{ |
| | | //添加列名 |
| | | foreach (DataColumn col in ds.Tables[0].Columns) |
| | | { |
| | | Type dataType = col.DataType; |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; |
| | | columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 |
| | | } |
| | | |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = columnNameList; |
| | | |
| | | return objJsonResult; |
| | | //} |
| | | //else |
| | | //{ |
| | | //objJsonResult.code = "0"; |
| | | //objJsonResult.count = 0; |
| | | //objJsonResult.Message = "无数据"; |
| | | //objJsonResult.data = null; |
| | | //return objJsonResult; |
| | | //} |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_MouldConkBookBillList", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | |
| | | |
| | | ds = Sc_MouldConkBookBillList_s(sWhere); |
| | | |
| | | //添加列名 |
| | | foreach (DataColumn col in ds.Tables[0].Columns) |
| | | { |
| | | Type dataType = col.DataType; |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; |
| | | columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = columnNameList; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception ex) |
| | |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | #region 器具故障记录统计分析 |
| | | /// <summary> |
| | | /// 器具维修记录统计分析 列表 |
| | | ///参数:string sql。 |
| | | ///返回值:object。 |
| | | /// </summary> |
| | | [Route("Sb_MouldRepairWorkBill/Sc_MouldConkBookBillMain")] |
| | | [HttpGet] |
| | | public object Sc_MouldConkBookBillMain(string DateYear, string HType, string user) |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | |
| | | if (DateYear == null || DateYear.Equals("")) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "请选择有效年份"; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | ds = oCN.RunProcReturn("exec h_p_Sc_MouldConkBookBillMain'" + DateYear + "','" + HType + "'", "h_p_Sc_MouldConkBookBillMain"); |
| | | } |
| | | |
| | | //添加列名 |
| | | foreach (DataColumn col in ds.Tables[0].Columns) |
| | | { |
| | | Type dataType = col.DataType; |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; |
| | | columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = columnNameList; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region sql语句 |
| | | |
| | |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | if (!DBUtility.ClsPub.Security_Log("Sb_MouldRepairWorkBillList", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | |
| | | |
| | | ds = Sc_MouldRepairWorkBillList_s(sWhere); |
| | | |
| | | //添加列名 |
| | | foreach (DataColumn col in ds.Tables[0].Columns) |
| | | { |
| | | Type dataType = col.DataType; |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; |
| | | columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 |
| | | } |
| | | |
| | | //if (ds.Tables[0].Rows.Count != 0 || ds != null) |
| | | //{ |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = columnNameList; |
| | | return objJsonResult; |
| | | //} |
| | | //else |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region 直接调拨单 |
| | | |
| | | #region 直接调拨单 保存/编辑 |
| | | /// <summary> |
| | | /// 直接调拨单 |
| | | /// </summary> |
| | | /// <param name="msg"></param> |
| | | /// <returns></returns> |
| | | [Route("Kf_MoveStockBill/SaveKf_MoveStockBillMain")] |
| | | [HttpPost] |
| | | public object SaveKf_MoveStockBillMain([FromBody] JObject msg) |
| | | { |
| | | var _value = msg["msg"].ToString(); |
| | | string msg1 = _value.ToString(); |
| | | string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); |
| | | string msg2 = sArray[0].ToString(); |
| | | string msg3 = sArray[1].ToString(); //子表 |
| | | string refSav = sArray[2].ToString();//操作方式数据类型 1添加 3修改 2 复制 |
| | | string msg4 = sArray[3].ToString();//用户名 |
| | | DBUtility.ClsPub.CurUserName = msg4; |
| | | |
| | | string UserName = ""; |
| | | string s = ""; |
| | | ListModels oListModels = new ListModels(); |
| | | try |
| | | { |
| | | if (!DBUtility.ClsPub.Security_Log("Kf_MoveStockBill_Edit", 1, false, msg4)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无保存权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | DAL.ClsKf_MoveStockBill oBill = new DAL.ClsKf_MoveStockBill(); |
| | | List<Model.ClsKf_MoveStockBillMain> lsmain = new List<Model.ClsKf_MoveStockBillMain>(); |
| | | msg2 = msg2.Replace("\\", ""); |
| | | msg2 = msg2.Replace("\n", ""); //\n |
| | | lsmain = oListModels.getObjectByJson_Kf_MoveStockBillMain(msg2); |
| | | foreach (Model.ClsKf_MoveStockBillMain oItem in lsmain) |
| | | { |
| | | if (refSav == "Add") |
| | | { |
| | | //单据号是否重复 |
| | | if (BillNew0.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld.omodel.HInterID)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据号重复!不允许保存!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | if (refSav == "Update") |
| | | { |
| | | if (oBill.ShowBill(oItem.HInterID, ref s) == false) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "此单据有误!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | //判断是否可编辑 |
| | | if (oBill.omodel.HChecker != "" && oBill.omodel.HChecker != null) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "此单据已经被审核,不允许修改!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | if (oBill.omodel.HBillStatus > 1) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "此单据处于不可编辑状态,不允许修改!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(oBill, ref s)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = s + ",不允许修改"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | oItem.HMaker = msg4; |
| | | UserName = oItem.HMaker; //制单人 |
| | | oItem.HBillType = "1207"; |
| | | oItem.HBillSubType = "1207"; |
| | | |
| | | |
| | | oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); |
| | | oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month); |
| | | oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); |
| | | |
| | | if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!没有单据日期,无法保存!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | oBill.omodel = oItem; |
| | | } |
| | | //表体数据 |
| | | //按 },{来拆分数组 //去掉【和】 |
| | | msg3 = msg3.Substring(1, msg3.Length - 2); |
| | | msg3 = msg3.Replace("\\", ""); |
| | | msg3 = msg3.Replace("\n", ""); //\n |
| | | //msg2 = msg2.Replace("'", "’"); |
| | | List<Model.ClsKf_MoveStockBillSub> ls = new List<Model.ClsKf_MoveStockBillSub>(); |
| | | ls = oListModels.getObjectByJson_Kf_MoveStockBillSub(msg3); |
| | | int i = 0; |
| | | oBill.DetailColl.Clear(); |
| | | foreach (Model.ClsKf_MoveStockBillSub oItemSub in ls) |
| | | { |
| | | |
| | | i++; |
| | | oItemSub.HEntryID = i; |
| | | |
| | | |
| | | oItemSub.HCloseType = false; //关闭类型 |
| | | |
| | | //oItemSub.HSourceInterID = 0; // 源单主内码 |
| | | //oItemSub.HSourceEntryID = 0; //源单子内码 |
| | | |
| | | |
| | | oBill.DetailColl.Add(oItemSub); |
| | | |
| | | } |
| | | //保存 |
| | | //保存完毕后处理 |
| | | bool bResult; |
| | | if (refSav == "Add") |
| | | { |
| | | |
| | | bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | } |
| | | else if (refSav == "Update") |
| | | { |
| | | bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | } |
| | | else |
| | | { |
| | | bResult = false; |
| | | } |
| | | if (bResult) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "保存成功!"; |
| | | //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单"); |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!" + e.ToString(); |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 直接调拨单 编辑页面初始化 |
| | | [Route("Kf_MoveStockBill/Kf_MoveStockBillEdit")] |
| | | [HttpGet] |
| | | public object Kf_MoveStockBillEdit(long HInterID) |
| | | { |
| | | try |
| | | { |
| | | List<DataTable> tableList = new List<DataTable>(); |
| | | |
| | | ds = oCN.RunProcReturn("exec h_p_Kf_MoveStockBill_Edit " + HInterID, "h_p_Kf_MoveStockBill_Edit"); |
| | | tableList.Add(ds.Tables[0]); |
| | | tableList.Add(ds.Tables[1]); |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "false!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = tableList; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 直接调拨单 审核/反审核功能 |
| | | [Route("Kf_MoveStockBill/CheckKf_MoveStockBill")] |
| | | [HttpGet] |
| | | public object CheckKf_MoveStockBill(string HInterID, int Type, string user) |
| | | { |
| | | try |
| | | { |
| | | Int64 lngBillKey = 0; |
| | | lngBillKey = DBUtility.ClsPub.isLong(HInterID); |
| | | DAL.ClsKf_OtherInBill oBill = new DAL.ClsKf_OtherInBill(); |
| | | |
| | | //判断是否有删除权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Kf_MoveStockBill_Check", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无权限审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (string.IsNullOrWhiteSpace(HInterID)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HInterID为空!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作 |
| | | if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //根据HInterID获取该单据的数据 |
| | | { |
| | | if (oBill.omodel.HCloseMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已关闭!不能再次审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (oBill.omodel.HDeleteMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已作废!不能再次审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | |
| | | ClsPub.CurUserName = user; |
| | | BillOld.MvarItemKey = "Kf_ICStockBillMain"; |
| | | oCN.BeginTran();//开始事务 |
| | | |
| | | |
| | | |
| | | //Type 1 审核 2 反审核 |
| | | if (Type == 1) |
| | | { |
| | | |
| | | //判断单据是否已经审核 |
| | | DataSet ds; |
| | | |
| | | string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; |
| | | ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); |
| | | if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已审核!不需要再审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | //审核前控制========================================= |
| | | string sql1 = "exec h_p_Kf_MoveStockBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Kf_MoveStockBill_BeforeCheckCtrl"); |
| | | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系"; |
| | | objJsonResult.data = null; |
| | | oCN.RollBack(); |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; |
| | | objJsonResult.data = null; |
| | | oCN.RollBack(); |
| | | return objJsonResult; |
| | | } |
| | | //================================================================================== |
| | | |
| | | |
| | | //审核单据 |
| | | if (!oBill.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Kf_MoveStockBill_AfterCheckCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //判断单据是否已经反审核 |
| | | DataSet ds; |
| | | string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; |
| | | ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); |
| | | if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已反审核!不需要再反审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | |
| | | //反审核前控制========================================= |
| | | string sql1 = "exec h_p_Kf_MoveStockBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Kf_MoveStockBill_BeforeUnCheckCtrl"); |
| | | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | |
| | | } |
| | | if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //=========================================================== |
| | | |
| | | |
| | | //反审核单据 |
| | | if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Kf_MoveStockBill_AfterUnCheckCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | | { |
| | | |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | oCN.Commit();//提交事务 |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "执行成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "执行失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 直接调拨单 关闭/反关闭功能 |
| | | [Route("Kf_MoveStockBill/CloseKf_MoveStockBill")] |
| | | [HttpGet] |
| | | public object CloseKf_MoveStockBill(string HInterID, int Type, string user) |
| | | { |
| | | try |
| | | { |
| | | //判断是否有删除权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Kf_MoveStockBill_Close", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无权限关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (string.IsNullOrWhiteSpace(HInterID)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HInterID为空!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | ClsPub.CurUserName = user; |
| | | BillOld.MvarItemKey = "Kf_ICStockBillMain"; |
| | | oCN.BeginTran();//开始事务 |
| | | |
| | | //Type 1 关闭 2 反关闭 |
| | | if (Type == 1) |
| | | { |
| | | //判断单据是否已经关闭 |
| | | DataSet ds; |
| | | string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; |
| | | ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); |
| | | if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已关闭!不需要再关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | //关闭单据 |
| | | if (!BillOld.CloseBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "关闭失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //判断单据是否已经反关闭 |
| | | DataSet ds; |
| | | string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; |
| | | ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); |
| | | if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | if (ds.Tables[0].Rows[0]["HCloseMan"] == null || ds.Tables[0].Rows[0]["HCloseMan"].ToString() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已反关闭!不需要再反关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | //反关闭单据 |
| | | if (!BillOld.CancelClose(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "反关闭失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | oCN.Commit();//提交事务 |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "执行成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "执行失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 直接调拨单 作废/反作废功能 |
| | | [Route("Kf_MoveStockBill/DropKf_MoveStockBill")] |
| | | [HttpGet] |
| | | public object DropKf_MoveStockBill(string HInterID, int Type, string user) |
| | | { |
| | | try |
| | | { |
| | | //判断是否有作废权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Kf_MoveStockBill_Drop", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无权限作废!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (string.IsNullOrWhiteSpace(HInterID)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HInterID为空!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | ClsPub.CurUserName = user; |
| | | BillOld.MvarItemKey = "Kf_ICStockBillMain"; |
| | | oCN.BeginTran();//开始事务 |
| | | |
| | | //Type 1 作废 2 反作废 |
| | | if (Type == 1) |
| | | { |
| | | //判断单据是否已经作废 |
| | | DataSet ds; |
| | | string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; |
| | | ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据不存在!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已审核!不能进行作废!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已作废!不需要再作废!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //作废单据 |
| | | if (!BillOld.Cancelltion(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "作废失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //判断单据是否已经反作废 |
| | | DataSet ds; |
| | | string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; |
| | | ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); |
| | | if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已审核!不能进行作废!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (ds.Tables[0].Rows[0]["HDeleteMan"] == null || ds.Tables[0].Rows[0]["HDeleteMan"].ToString() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未作废!不需要再反作废!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //反作废单据 |
| | | if (!BillOld.AbandonCancelltion(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "反作废失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | |
| | | oCN.Commit();//提交事务 |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "执行成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "执行失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 直接调拨单列表 |
| | | /// <summary> |
| | | /// 调拨单列表 |
| | | /// </summary> |
| | |
| | | ds = oCN.RunProcReturn(sql, "h_v_IF_MoveStockBillList"); |
| | | } |
| | | |
| | | //if (ds.Tables[0].Rows.Count != 0 || ds != null) |
| | | //{ |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | //} |
| | | //else |
| | | //{ |
| | | //objJsonResult.code = "0"; |
| | | //objJsonResult.count = 0; |
| | | //objJsonResult.Message = "无数据"; |
| | | //objJsonResult.data = null; |
| | | //return objJsonResult; |
| | | //} |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 直接调拨单 删除 |
| | | [Route("Kf_MoveStockBill/DelteteGetMoveStockBill")] |
| | | [HttpGet] |
| | | public object DelteteGetMoveStockBill(string HInterID, string user) |
| | | { |
| | | try |
| | | { |
| | | string s = ""; |
| | | DAL.ClsKf_MoveStockBill oBill = new DAL.ClsKf_MoveStockBill(); |
| | | |
| | | //判断是否有删除权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Kf_MoveStockBill_Drop", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无权限删除!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //删除前控制========================================= |
| | | string sql1 = "exec h_p_Kf_MoveStockBill_BeforeDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Kf_MoveStockBill_BeforeDelCtrl"); |
| | | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "删除失败!原因:删除前判断失败,请与网络管理人员联系"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "删除失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //================================================================================== |
| | | |
| | | oCN.BeginTran(); |
| | | |
| | | //直接调拨单 删除 撤销 回填 调拨申请单 关联数量 |
| | | oCN.RunProc("exec h_p_Kf_UpDateRelation_MoveStockRequestToPOStockIn_Del " + HInterID); |
| | | |
| | | oCN.RunProc("Delete From Kf_ICStockBillMain where HInterID = " + HInterID); |
| | | oCN.RunProc("Delete From Kf_ICStockBillSub where HInterID = " + HInterID); |
| | | |
| | | //删除后控制================================================================================== |
| | | string sql2 = "exec h_p_Kf_MoveStockBill_AfterDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql2, "h_p_Kf_MoveStockBill_AfterDelCtrl"); |
| | | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | s = "删除后判断失败,请与网络管理人员联系"; |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "删除失败!原因:" + s; |
| | | objJsonResult.data = null; |
| | | oCN.RollBack(); |
| | | return objJsonResult; |
| | | } |
| | | if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") |
| | | { |
| | | s = ds.Tables[0].Rows[0]["HRemark"].ToString(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "删除失败!原因:" + s; |
| | | objJsonResult.data = null; |
| | | oCN.RollBack(); |
| | | return objJsonResult; |
| | | } |
| | | //============================================================================================== |
| | | |
| | | oCN.Commit(); |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "删除成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 直接调拨单 根据主内码与子内码获取调拨申请单数据 |
| | | [Route("Kf_MoveStockBill/loadKf_MoveStockBillMain_Push")] |
| | | [HttpGet] |
| | | public object loadKf_MoveStockBillMain_Push(long HInterID, long HSubID) |
| | | { |
| | | try |
| | | { |
| | | |
| | | ds = oCN.RunProcReturn("select * from h_v_IF_MoveStockRequestBillList_Litee where hmainid =" + HInterID + " and hsubid = " + HSubID, "h_v_IF_MoveStockRequestBillList_Litee"); |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "未查询到源单信息!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | | |
| | | /// <summary> |
| | | /// 销售出库单列表 |
| | |
| | | { |
| | | try |
| | | { |
| | | DAL.ClsKf_SellOutBill BillOld = new DAL.ClsKf_SellOutBill(); |
| | | string s = ""; |
| | | |
| | | //判断是否有删除权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Kf_SellOutBill_Drop", 1, false, user)) |
| | | { |
| | |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (BillOld.ShowBill(long.Parse(HInterID), ref s) == false) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "此单据有误!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | //判断是否可编辑 |
| | | if (BillOld.omodel.HChecker != "" && BillOld.omodel.HChecker != null) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "此单据已经被审核,不允许删除!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //删除前控制========================================= |
| | | string sql1 = "exec h_p_Kf_SellOutBill_BeforeDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Kf_SellOutBill_BeforeDelCtrl"); |
| | | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "删除失败!原因:删除前判断失败,请与网络管理人员联系"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "删除失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //================================================================================== |
| | | |
| | | |
| | | oCN.BeginTran(); |
| | | //销售出库删除回填销售订单关联数量 |
| | | oCN.RunProc("exec h_p_Xs_UpDateRelation_SeOrderToSellOut_Delete " + HInterID); |
| | | |
| | | //销售出库删除回填收货通知单关联数量 |
| | | oCN.RunProc("exec h_p_Xs_UpDateRelation_SeOutStockToPOStockIn_Delete " + HInterID); |
| | | |
| | | |
| | | oCN.RunProc("Delete From Kf_ICStockBillMain where HInterID = " + HInterID); |
| | | oCN.RunProc("Delete From Kf_ICStockBillSub where HInterID = " + HInterID); |
| | | |
| | | //string sql = "exec h_p_WMS_ICStockBillAndWMS_Delete " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','1205'"; |
| | | //oCn.RunProc(sql); |
| | | |
| | | //删除后控制================================================================================== |
| | | string sql2 = "exec h_p_Kf_SellOutBill_AfterDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql2, "h_p_Kf_SellOutBill_AfterDelCtrl"); |
| | | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | s = "删除后判断失败,请与网络管理人员联系"; |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "删除失败!原因:" + s; |
| | | objJsonResult.data = null; |
| | | oCN.RollBack(); |
| | | return objJsonResult; |
| | | } |
| | | if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") |
| | | { |
| | | s = ds.Tables[0].Rows[0]["HRemark"].ToString(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "删除失败!原因:" + s; |
| | | objJsonResult.data = null; |
| | | oCN.RollBack(); |
| | | return objJsonResult; |
| | | } |
| | | //============================================================================================== |
| | | |
| | | oCN.Commit(); |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "删除成功!"; |
| | | objJsonResult.Message = "您已删除单据号为" + BillOld.omodel.HBillNo + "的销售出库单!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | |
| | | { |
| | | if (sWhere == null || sWhere.Equals("")) |
| | | { |
| | | return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_IF_SellOutBillList order by hmainid desc", "h_v_IF_SellOutBillList"); |
| | | return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_IF_SellOutBillList order by 制单日期 desc,单据号 desc", "h_v_IF_SellOutBillList"); |
| | | } |
| | | else |
| | | { |
| | | return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_IF_SellOutBillList where 1=1 " + sWhere + " order by hmainid desc", "h_v_IF_SellOutBillList"); |
| | | return new SQLHelper.ClsCN().RunProcReturn("select * from h_v_IF_SellOutBillList where 1=1 " + sWhere + " order by 制单日期 desc,单据号 desc", "h_v_IF_SellOutBillList"); |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 其他出库单 |
| | | #region 其他出库单保存/编辑 |
| | | /// <summary> |
| | | /// 其他入库单 |
| | | /// </summary> |
| | | /// <param name="msg"></param> |
| | | /// <returns></returns> |
| | | [Route("Kf_OtherOutBill/SaveKf_OtherOutBillMain")] |
| | | [HttpPost] |
| | | public object SaveKf_OtherOutBillMain([FromBody] JObject msg) |
| | | { |
| | | var _value = msg["msg"].ToString(); |
| | | string msg1 = _value.ToString(); |
| | | string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); |
| | | string msg2 = sArray[0].ToString(); |
| | | string msg3 = sArray[1].ToString(); //子表 |
| | | string refSav = sArray[2].ToString();//操作方式数据类型 1添加 3修改 2 复制 |
| | | string msg4 = sArray[3].ToString();//用户名 |
| | | DBUtility.ClsPub.CurUserName = msg4; |
| | | |
| | | string UserName = ""; |
| | | string s = ""; |
| | | ListModels oListModels = new ListModels(); |
| | | try |
| | | { |
| | | if (!DBUtility.ClsPub.Security_Log("Kf_OtherOutBill_Edit", 1, false, msg4)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无保存权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | DAL.ClsKf_OtherOutBill oBill = new DAL.ClsKf_OtherOutBill(); |
| | | List<Model.ClsKf_OtherOutBillMain> lsmain = new List<Model.ClsKf_OtherOutBillMain>(); |
| | | msg2 = msg2.Replace("\\", ""); |
| | | msg2 = msg2.Replace("\n", ""); //\n |
| | | lsmain = oListModels.getObjectByJson_Kf_OtherOutBillMain(msg2); |
| | | foreach (Model.ClsKf_OtherOutBillMain oItem in lsmain) |
| | | { |
| | | if (refSav == "Add") |
| | | { |
| | | //单据号是否重复 |
| | | if (BillNew0.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld.omodel.HInterID)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据号重复!不允许保存!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | if (refSav == "Update") |
| | | { |
| | | if (oBill.ShowBill(oItem.HInterID, ref s) == false) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "此单据有误!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | //判断是否可编辑 |
| | | if (oBill.omodel.HChecker != "" && oBill.omodel.HChecker != null) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "此单据已经被审核,不允许修改!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | if (oBill.omodel.HBillStatus > 1) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "此单据处于不可编辑状态,不允许修改!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(oBill, ref s)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = s + ",不允许修改"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | oItem.HMaker = msg4; |
| | | UserName = oItem.HMaker; //制单人 |
| | | oItem.HBillType = "1206"; |
| | | oItem.HBillSubType = "1206"; |
| | | |
| | | |
| | | oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); |
| | | oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month); |
| | | oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); |
| | | |
| | | if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!没有单据日期,无法保存!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | oBill.omodel = oItem; |
| | | } |
| | | //表体数据 |
| | | //按 },{来拆分数组 //去掉【和】 |
| | | msg3 = msg3.Substring(1, msg3.Length - 2); |
| | | msg3 = msg3.Replace("\\", ""); |
| | | msg3 = msg3.Replace("\n", ""); //\n |
| | | //msg2 = msg2.Replace("'", "’"); |
| | | List<Model.ClsKf_OtherOutBillSub> ls = new List<Model.ClsKf_OtherOutBillSub>(); |
| | | ls = oListModels.getObjectByJson_Kf_OtherOutBillSub(msg3); |
| | | int i = 0; |
| | | oBill.DetailColl.Clear(); |
| | | foreach (Model.ClsKf_OtherOutBillSub oItemSub in ls) |
| | | { |
| | | |
| | | i++; |
| | | oItemSub.HEntryID = i; |
| | | |
| | | |
| | | oItemSub.HCloseType = false; //关闭类型 |
| | | |
| | | oItemSub.HSourceInterID = 0; // 源单主内码 |
| | | oItemSub.HSourceEntryID = 0; //源单子内码 |
| | | |
| | | |
| | | oBill.DetailColl.Add(oItemSub); |
| | | |
| | | } |
| | | //保存 |
| | | //保存完毕后处理 |
| | | bool bResult; |
| | | if (refSav == "Add") |
| | | { |
| | | |
| | | bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | } |
| | | else if (refSav == "Update") |
| | | { |
| | | bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | } |
| | | else |
| | | { |
| | | bResult = false; |
| | | } |
| | | if (bResult) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "保存成功!"; |
| | | //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单"); |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!" + e.ToString(); |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 其他出库单 编辑页面初始化 |
| | | [Route("Kf_OtherOutBill/Kf_OtherOutBillEdit")] |
| | | [HttpGet] |
| | | public object Kf_OtherOutBillEdit(long HInterID) |
| | | { |
| | | try |
| | | { |
| | | List<DataTable> tableList = new List<DataTable>(); |
| | | |
| | | ds = oCN.RunProcReturn("exec h_p_Kf_OtherOutBill_Edit " + HInterID, "h_p_Kf_OtherOutBill_Edit"); |
| | | tableList.Add(ds.Tables[0]); |
| | | tableList.Add(ds.Tables[1]); |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "false!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = tableList; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 其他出库单列表 |
| | | /// <summary> |
| | | /// 其他出库单列表 |
| | | /// </summary> |
| | |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 其他出库单 删除 |
| | | [Route("Kf_OtherOutBill/DelteteGetOtherOutBill")] |
| | | [HttpGet] |
| | | public object DelteteGetOtherOutBill(string HInterID, string user) |
| | | { |
| | | try |
| | | { |
| | | string s = ""; |
| | | DAL.ClsKf_OtherInBill oBill = new DAL.ClsKf_OtherInBill(); |
| | | |
| | | //判断是否有删除权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Kf_OtherOutBill_Drop", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无权限删除!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (oBill.ShowBill(long.Parse(HInterID), ref s) == false) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "此单据有误!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | //判断是否可编辑 |
| | | if (oBill.omodel.HChecker != "" && oBill.omodel.HChecker != null) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "此单据已经被审核,不允许删除!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //删除前控制========================================= |
| | | string sql1 = "exec h_p_Kf_OtherOutBill_BeforeDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Kf_ICStockBill_BeforeDelCtrl"); |
| | | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "删除失败!原因:删除前判断失败,请与网络管理人员联系"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "删除失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //================================================================================== |
| | | |
| | | oCN.BeginTran(); |
| | | oCN.RunProc("Delete From Kf_ICStockBillMain where HInterID = " + HInterID); |
| | | oCN.RunProc("Delete From Kf_ICStockBillSub where HInterID = " + HInterID); |
| | | |
| | | |
| | | //删除后控制================================================================================== |
| | | string sql2 = "exec h_p_Kf_OtherOutBill_AfterDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql2, "h_p_Kf_ICStockBill_AfterDelCtrl"); |
| | | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | s = "删除后判断失败,请与网络管理人员联系"; |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "删除失败!原因:" + s; |
| | | objJsonResult.data = null; |
| | | oCN.RollBack(); |
| | | return objJsonResult; |
| | | } |
| | | if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") |
| | | { |
| | | s = ds.Tables[0].Rows[0]["HRemark"].ToString(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "删除失败!原因:" + s; |
| | | objJsonResult.data = null; |
| | | oCN.RollBack(); |
| | | return objJsonResult; |
| | | } |
| | | //============================================================================================== |
| | | |
| | | oCN.Commit(); |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "删除成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 其它出库单审核/反审核功能 |
| | | [Route("Kf_OtherOutBill/CheckKf_OtherOutBill")] |
| | | [HttpGet] |
| | | public object CheckKf_OtherOutBill(string HInterID, int Type, string user) |
| | | { |
| | | try |
| | | { |
| | | Int64 lngBillKey = 0; |
| | | lngBillKey = DBUtility.ClsPub.isLong(HInterID); |
| | | DAL.ClsKf_OtherOutBill oBill = new DAL.ClsKf_OtherOutBill() ; |
| | | |
| | | //判断是否有删除权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Kf_OtherOutBill_Check", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无权限审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (string.IsNullOrWhiteSpace(HInterID)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HInterID为空!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作 |
| | | if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //根据HInterID获取该单据的数据 |
| | | { |
| | | if (oBill.omodel.HCloseMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已关闭!不能再次审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (oBill.omodel.HDeleteMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已作废!不能再次审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | ClsPub.CurUserName = user; |
| | | BillOld.MvarItemKey = "Kf_ICStockBillMain"; |
| | | oCN.BeginTran();//开始事务 |
| | | |
| | | //Type 1 审核 2 反审核 |
| | | if (Type == 1) |
| | | { |
| | | //判断单据是否已经审核 |
| | | DataSet ds; |
| | | string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; |
| | | ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); |
| | | if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已审核!不需要再审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | //审核前控制========================================= |
| | | string sql1 = "exec h_p_Kf_OtherOutBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Kf_ICStockBill_BeforeCheckCtrl"); |
| | | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系"; |
| | | objJsonResult.data = null; |
| | | oCN.RollBack(); |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; |
| | | objJsonResult.data = null; |
| | | oCN.RollBack(); |
| | | return objJsonResult; |
| | | } |
| | | //================================================================================== |
| | | |
| | | |
| | | |
| | | //审核单据 |
| | | if (!oBill.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Kf_OtherOutBill_AfterCheckCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //判断单据是否已经反审核 |
| | | DataSet ds; |
| | | string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; |
| | | ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); |
| | | if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已反审核!不需要再反审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | //反审核前控制========================================= |
| | | string sql1 = "exec h_p_Kf_OtherOutBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Kf_ICStockBill_BeforeUnCheckCtrl"); |
| | | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | |
| | | } |
| | | if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //=========================================================== |
| | | |
| | | //反审核单据 |
| | | if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Kf_OtherOutBill_AfterUnCheckCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | | { |
| | | //SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | //DataSet DSet = oCn.RunProcReturn("exec h_p_Sc_ICMOBill_AbandonCheckCtrl " + int.Parse(HInterID), "h_p_Sc_ICMOBill_AbandonCheckCtrl"); |
| | | ////if (DBUtility.ClsPub.isInt(DSet.Tables[0].Rows[0]["Hback"]) != 0) |
| | | ////{ |
| | | //// objJsonResult.code = "0"; |
| | | //// objJsonResult.count = 1; |
| | | //// objJsonResult.Message = "该任务单已下推流转卡,不允许反审核" + DBUtility.ClsPub.isStrNull(DSet.Tables[0].Rows[0]["HBackRemark"]); |
| | | //// objJsonResult.data = null; |
| | | //// return objJsonResult; |
| | | ////} |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | oCN.Commit();//提交事务 |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "执行成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "执行失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 其它出库单关闭/反关闭功能 |
| | | [Route("Kf_OtherOutBill/CloseKf_OtherOutBill")] |
| | | [HttpGet] |
| | | public object CloseKf_OtherOutBill(string HInterID, int Type, string user) |
| | | { |
| | | try |
| | | { |
| | | //判断是否有删除权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Kf_OtherOutBill_Close", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无权限关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (string.IsNullOrWhiteSpace(HInterID)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HInterID为空!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | ClsPub.CurUserName = user; |
| | | BillOld.MvarItemKey = "Kf_ICStockBillMain"; |
| | | oCN.BeginTran();//开始事务 |
| | | |
| | | //Type 1 关闭 2 反关闭 |
| | | if (Type == 1) |
| | | { |
| | | //判断单据是否已经关闭 |
| | | DataSet ds; |
| | | string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; |
| | | ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); |
| | | if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已关闭!不需要再关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | //关闭单据 |
| | | if (!BillOld.CloseBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "关闭失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //判断单据是否已经反关闭 |
| | | DataSet ds; |
| | | string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; |
| | | ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); |
| | | if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | if (ds.Tables[0].Rows[0]["HCloseMan"] == null || ds.Tables[0].Rows[0]["HCloseMan"].ToString() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已反关闭!不需要再反关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | //反关闭单据 |
| | | if (!BillOld.CancelClose(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "反关闭失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | oCN.Commit();//提交事务 |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "执行成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "执行失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 其它出库单 作废/反作废功能 |
| | | [Route("Kf_OtherInBill/DropKf_ICStockBill")] |
| | | [HttpGet] |
| | | public object DropKf_ICStockBill(string HInterID, int Type, string user) |
| | | { |
| | | try |
| | | { |
| | | //判断是否有作废权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Kf_OtherInBill_Drop", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无权限作废!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (string.IsNullOrWhiteSpace(HInterID)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HInterID为空!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | ClsPub.CurUserName = user; |
| | | BillOld.MvarItemKey = "Kf_ICStockBillMain"; |
| | | oCN.BeginTran();//开始事务 |
| | | |
| | | //Type 1 作废 2 反作废 |
| | | if (Type == 1) |
| | | { |
| | | //判断单据是否已经作废 |
| | | DataSet ds; |
| | | string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; |
| | | ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据不存在!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已审核!不能进行作废!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已作废!不需要再作废!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //作废单据 |
| | | if (!BillOld.Cancelltion(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "作废失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //判断单据是否已经反作废 |
| | | DataSet ds; |
| | | string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; |
| | | ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); |
| | | if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已审核!不能进行作废!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (ds.Tables[0].Rows[0]["HDeleteMan"] == null || ds.Tables[0].Rows[0]["HDeleteMan"].ToString() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未作废!不需要再反作废!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //反作废单据 |
| | | if (!BillOld.AbandonCancelltion(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "反作废失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | |
| | | oCN.Commit();//提交事务 |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "执行成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "执行失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 产品入库单列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [Route("Kf_ProductInBill/GetProductInBill")] |
| | | #region 条码明细 |
| | | [Route("Kf_ICStockBillSub_WMS/Kf_ICStockBillSub_WMS_List")] |
| | | [HttpGet] |
| | | public object GetProductInBill(string sWhere,string user) |
| | | public object Kf_ICStockBillSub_WMS_List(string sWhere, string user) |
| | | { |
| | | try |
| | | { |
| | | //判断是否有查询权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Kf_ProductInBill_Query", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无查询权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | ds = oCN.RunProcReturn(@"Select m.HNumber 物料代码,m.HName 物料名称,m.HModel 规格型号 |
| | | ,wms.HBarCode 条码,wms.HQty 数量,w.HNumber 仓库代码,w.HName 仓库名称 from Kf_ICStockBillSub_WMS wms |
| | | left join h_v_IF_Material m on wms.HMaterID = m.HItemID |
| | | left join h_v_IF_Warehouse w on wms.HWhID = w.HItemID where 1=1 "+ sWhere, "Kf_ICStockBillSub_WMS"); |
| | | |
| | | |
| | | if (sWhere == null || sWhere.Equals("")) |
| | | { |
| | | ds = oCN.RunProcReturn("select * from h_v_IF_ProductInBillList where 1=1 order by hmainid desc", "h_v_IF_ProductInBillList"); |
| | | } |
| | | else |
| | | { |
| | | string sql = "select * from h_v_IF_ProductInBillList where 1 = 1 " + sWhere + " order by hmainid desc"; |
| | | ds = oCN.RunProcReturn(sql, "h_v_IF_ProductInBillList"); |
| | | } |
| | | |
| | | //if (ds.Tables[0].Rows.Count != 0 || ds != null) |
| | | //{ |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | //} |
| | | //else |
| | | //{ |
| | | //objJsonResult.code = "0"; |
| | | //objJsonResult.count = 0; |
| | | //objJsonResult.Message = "无数据"; |
| | | //objJsonResult.data = null; |
| | | //return objJsonResult; |
| | | //} |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 其他入库单 |
| | | |
| | | #region 其他入库单保存/编辑 |
| | | /// <summary> |
| | | ///产品入库单删除功能 |
| | | /// 其他入库单 |
| | | /// </summary> |
| | | /// <param name="msg"></param> |
| | | /// <returns></returns> |
| | | [Route("Kf_ProductInBill/DeltetProductInBill")] |
| | | [HttpGet] |
| | | public object DeltetProductInBill(string HInterID) |
| | | [Route("Kf_OtherInBill/SaveKf_OtherInBillMain")] |
| | | [HttpPost] |
| | | public object SaveKf_OtherInBillMain([FromBody] JObject msg) |
| | | { |
| | | var _value = msg["msg"].ToString(); |
| | | string msg1 = _value.ToString(); |
| | | string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); |
| | | string msg2 = sArray[0].ToString(); |
| | | string msg3 = sArray[1].ToString(); //子表 |
| | | string refSav = sArray[2].ToString();//操作方式数据类型 1添加 3修改 2 复制 |
| | | string msg4 = sArray[3].ToString();//用户名 |
| | | DBUtility.ClsPub.CurUserName = msg4; |
| | | |
| | | string UserName = ""; |
| | | string s = ""; |
| | | ListModels oListModels = new ListModels(); |
| | | try |
| | | { |
| | | oCN.BeginTran(); |
| | | oCN.RunProc("Delete From Kf_ICStockBillMain where HInterID = " + HInterID); |
| | | oCN.RunProc("Delete From Kf_ICStockBillSub where HInterID = " + HInterID); |
| | | oCN.Commit(); |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "删除成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | if (!DBUtility.ClsPub.Security_Log("Kf_OtherInBill_Edit", 1, false, msg4)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无保存权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | DAL.ClsKf_OtherInBill oBill = new DAL.ClsKf_OtherInBill(); |
| | | List<Model.ClsKf_OtherInBillMain> lsmain = new List<Model.ClsKf_OtherInBillMain>(); |
| | | msg2 = msg2.Replace("\\", ""); |
| | | msg2 = msg2.Replace("\n", ""); //\n |
| | | lsmain = oListModels.getObjectByJson_Kf_OtherInBillMain(msg2); |
| | | foreach (Model.ClsKf_OtherInBillMain oItem in lsmain) |
| | | { |
| | | if (refSav == "Add") |
| | | { |
| | | //单据号是否重复 |
| | | if (BillNew0.IsExistBillNo(ref ClsPub.sExeReturnInfo, oItem.HBillNo, BillStatus, BillOld.omodel.HInterID)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据号重复!不允许保存!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | if (refSav == "Update") |
| | | { |
| | | if (oBill.ShowBill(oItem.HInterID, ref s) == false) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "此单据有误!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | //判断是否可编辑 |
| | | if (oBill.omodel.HChecker != "" && oBill.omodel.HChecker != null) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "此单据已经被审核,不允许修改!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | if (oBill.omodel.HBillStatus > 1) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "此单据处于不可编辑状态,不允许修改!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | if (!DBUtility.Xt_BaseBillFun.Fun_AllowEditBill(oBill, ref s)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = s + ",不允许修改"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | oItem.HMaker = msg4; |
| | | UserName = oItem.HMaker; //制单人 |
| | | oItem.HBillType = "1203"; |
| | | oItem.HBillSubType = "1203"; |
| | | |
| | | |
| | | oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); |
| | | oItem.HPeriod = DBUtility.ClsPub.isLong(DateTime.Now.Month); |
| | | oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); |
| | | |
| | | if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!没有单据日期,无法保存!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | oBill.omodel = oItem; |
| | | } |
| | | //表体数据 |
| | | //按 },{来拆分数组 //去掉【和】 |
| | | msg3 = msg3.Substring(1, msg3.Length - 2); |
| | | msg3 = msg3.Replace("\\", ""); |
| | | msg3 = msg3.Replace("\n", ""); //\n |
| | | //msg2 = msg2.Replace("'", "’"); |
| | | List<Model.ClsKf_OtherInBillSub> ls = new List<Model.ClsKf_OtherInBillSub>(); |
| | | ls = oListModels.getObjectByJson_Kf_OtherInBillSub(msg3); |
| | | int i = 0; |
| | | oBill.DetailColl.Clear(); |
| | | foreach (Model.ClsKf_OtherInBillSub oItemSub in ls) |
| | | { |
| | | |
| | | i++; |
| | | oItemSub.HEntryID = i; |
| | | |
| | | |
| | | oItemSub.HCloseType = false; //关闭类型 |
| | | |
| | | oItemSub.HSourceInterID = 0; // 源单主内码 |
| | | oItemSub.HSourceEntryID = 0; //源单子内码 |
| | | |
| | | |
| | | oBill.DetailColl.Add(oItemSub); |
| | | |
| | | } |
| | | //保存 |
| | | //保存完毕后处理 |
| | | bool bResult; |
| | | if (refSav == "Add") |
| | | { |
| | | |
| | | bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | } |
| | | else if (refSav == "Update") |
| | | { |
| | | bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | } |
| | | else |
| | | { |
| | | bResult = false; |
| | | } |
| | | if (bResult) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "保存成功!"; |
| | | //WebAPIController.Add_Log("送货单下推", UserName, "生成送货单"); |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!" + e.ToString(); |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 其他入库单 编辑页面初始化 |
| | | [Route("Kf_OtherInBill/Kf_OtherInBillEdit")] |
| | | [HttpGet] |
| | | public object Kf_OtherInBillEdit(long HInterID) |
| | | { |
| | | try |
| | | { |
| | | List<DataTable> tableList = new List<DataTable>(); |
| | | |
| | | ds = oCN.RunProcReturn("exec h_p_Kf_ICStockBillMain_Edit " + HInterID, "h_p_Kf_ICStockBillMain_Edit"); |
| | | tableList.Add(ds.Tables[0]); |
| | | tableList.Add(ds.Tables[1]); |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "false!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = tableList; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 其它入库单审核/反审核功能 |
| | | [Route("Kf_OtherInBill/CheckKf_OtherInBill")] |
| | | [HttpGet] |
| | | public object CheckKf_OtherInBill(string HInterID, int Type, string user) |
| | | { |
| | | try |
| | | { |
| | | Int64 lngBillKey = 0; |
| | | lngBillKey = DBUtility.ClsPub.isLong(HInterID); |
| | | DAL.ClsKf_OtherInBill oBill = new DAL.ClsKf_OtherInBill(); |
| | | |
| | | //判断是否有删除权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Kf_OtherInBill_Check", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无权限审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (string.IsNullOrWhiteSpace(HInterID)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HInterID为空!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //针对需要进行的操作,检验当前单据的状态是否支持需要进行的操作 |
| | | if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo)) //根据HInterID获取该单据的数据 |
| | | { |
| | | if (oBill.omodel.HCloseMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已关闭!不能再次审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (oBill.omodel.HDeleteMan.Trim() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已作废!不能再次审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | |
| | | ClsPub.CurUserName = user; |
| | | BillOld.MvarItemKey = "Kf_ICStockBillMain"; |
| | | oCN.BeginTran();//开始事务 |
| | | |
| | | |
| | | |
| | | //Type 1 审核 2 反审核 |
| | | if (Type == 1) |
| | | { |
| | | |
| | | //判断单据是否已经审核 |
| | | DataSet ds; |
| | | |
| | | string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; |
| | | ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); |
| | | if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已审核!不需要再审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | //审核前控制========================================= |
| | | string sql1 = "exec h_p_Kf_ICStockBill_BeforeCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Kf_ICStockBill_BeforeCheckCtrl"); |
| | | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:审核前判断失败,请与网络管理人员联系"; |
| | | objJsonResult.data = null; |
| | | oCN.RollBack(); |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; |
| | | objJsonResult.data = null; |
| | | oCN.RollBack(); |
| | | return objJsonResult; |
| | | } |
| | | //================================================================================== |
| | | |
| | | |
| | | //审核单据 |
| | | if (!oBill.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Kf_ICStockBill_AfterCheckCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //判断单据是否已经反审核 |
| | | DataSet ds; |
| | | string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; |
| | | ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); |
| | | if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | if (ds.Tables[0].Rows[0]["HChecker"] == null || ds.Tables[0].Rows[0]["HChecker"].ToString() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已反审核!不需要再反审核!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | |
| | | //反审核前控制========================================= |
| | | string sql1 = "exec h_p_Kf_ICStockBill_BeforeUnCheckCtrl " + oBill.omodel.HInterID + ",'" + oBill.omodel.HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Kf_ICStockBill_BeforeUnCheckCtrl"); |
| | | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "反审核失败!原因:反审核前判断失败,请与网络管理人员联系"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | |
| | | } |
| | | if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "反审核失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //=========================================================== |
| | | |
| | | |
| | | //反审核单据 |
| | | if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Kf_ICStockBill_AfterUnCheckCtrl", user, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | | { |
| | | //SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); |
| | | //DataSet DSet = oCn.RunProcReturn("exec h_p_Sc_ICMOBill_AbandonCheckCtrl " + int.Parse(HInterID), "h_p_Sc_ICMOBill_AbandonCheckCtrl"); |
| | | ////if (DBUtility.ClsPub.isInt(DSet.Tables[0].Rows[0]["Hback"]) != 0) |
| | | ////{ |
| | | //// objJsonResult.code = "0"; |
| | | //// objJsonResult.count = 1; |
| | | //// objJsonResult.Message = "该任务单已下推流转卡,不允许反审核" + DBUtility.ClsPub.isStrNull(DSet.Tables[0].Rows[0]["HBackRemark"]); |
| | | //// objJsonResult.data = null; |
| | | //// return objJsonResult; |
| | | ////} |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | oCN.Commit();//提交事务 |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "执行成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "执行失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 其它入库单关闭/反关闭功能 |
| | | [Route("Kf_OtherInBill/CloseKf_OtherInBill")] |
| | | [HttpGet] |
| | | public object CloseKf_OtherInBill(string HInterID, int Type, string user) |
| | | { |
| | | try |
| | | { |
| | | //判断是否有删除权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Kf_OtherInBill_Close", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无权限关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (string.IsNullOrWhiteSpace(HInterID)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HInterID为空!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | ClsPub.CurUserName = user; |
| | | BillOld.MvarItemKey = "Kf_ICStockBillMain"; |
| | | oCN.BeginTran();//开始事务 |
| | | |
| | | //Type 1 关闭 2 反关闭 |
| | | if (Type == 1) |
| | | { |
| | | //判断单据是否已经关闭 |
| | | DataSet ds; |
| | | string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; |
| | | ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); |
| | | if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | if (ds.Tables[0].Rows[0]["HCloseMan"] != null && ds.Tables[0].Rows[0]["HCloseMan"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已关闭!不需要再关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | //关闭单据 |
| | | if (!BillOld.CloseBill(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "关闭失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //判断单据是否已经反关闭 |
| | | DataSet ds; |
| | | string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; |
| | | ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); |
| | | if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | if (ds.Tables[0].Rows[0]["HCloseMan"] == null || ds.Tables[0].Rows[0]["HCloseMan"].ToString() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已反关闭!不需要再反关闭!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | //反关闭单据 |
| | | if (!BillOld.CancelClose(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "反关闭失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | oCN.Commit();//提交事务 |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "执行成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "执行失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 其他入库单 作废/反作废功能 |
| | | [Route("Kf_OtherInBill/DropKf_OtherInBill")] |
| | | [HttpGet] |
| | | public object DropKf_OtherInBill(string HInterID, int Type, string user) |
| | | { |
| | | try |
| | | { |
| | | //判断是否有作废权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Kf_OtherInBill_Drop", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无权限作废!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (string.IsNullOrWhiteSpace(HInterID)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HInterID为空!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | ClsPub.CurUserName = user; |
| | | BillOld.MvarItemKey = "Kf_ICStockBillMain"; |
| | | oCN.BeginTran();//开始事务 |
| | | |
| | | //Type 1 作废 2 反作废 |
| | | if (Type == 1) |
| | | { |
| | | //判断单据是否已经作废 |
| | | DataSet ds; |
| | | string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; |
| | | ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据不存在!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已审核!不能进行作废!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (ds.Tables[0].Rows[0]["HDeleteMan"] != null && ds.Tables[0].Rows[0]["HDeleteMan"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已作废!不需要再作废!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //作废单据 |
| | | if (!BillOld.Cancelltion(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "作废失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //判断单据是否已经反作废 |
| | | DataSet ds; |
| | | string sql = "select * from " + BillOld.MvarItemKey + " where HinterID = " + HInterID; |
| | | ds = oCN.RunProcReturn(sql, BillOld.MvarItemKey); |
| | | if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) |
| | | { |
| | | if (ds.Tables[0].Rows[0]["HChecker"] != null && ds.Tables[0].Rows[0]["HChecker"].ToString() != "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据已审核!不能进行作废!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | if (ds.Tables[0].Rows[0]["HDeleteMan"] == null || ds.Tables[0].Rows[0]["HDeleteMan"].ToString() == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "单据未作废!不需要再反作废!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //反作废单据 |
| | | if (!BillOld.AbandonCancelltion(Int64.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "反作废失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | } |
| | | |
| | | oCN.Commit();//提交事务 |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "执行成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; ; |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "执行失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 其他入库单列表 |
| | | /// <summary> |
| | | /// 其他入库单列表 |
| | | /// </summary> |
| | |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 其他入库单 删除 |
| | | /// <summary> |
| | | ///参数:string HInterID。 |
| | | ///返回值:object。 |
| | | /// </summary> |
| | | [Route("Kf_SellOutBill/DeleteKf_ICStockBillMain")] |
| | | [HttpGet] |
| | | public object DeleteKf_ICStockBillMain(string HInterID, string user) |
| | | { |
| | | try |
| | | { |
| | | string s = ""; |
| | | DAL.ClsKf_OtherInBill oBill = new DAL.ClsKf_OtherInBill(); |
| | | //查看权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Kf_OtherInBill_Drop", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无删除权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (HInterID == null || HInterID.Equals("")) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "HInterID不能为空!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (oBill.ShowBill(long.Parse(HInterID), ref s) == false) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "此单据有误!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | //判断是否可编辑 |
| | | if (oBill.omodel.HChecker != "" && oBill.omodel.HChecker != null) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "此单据已经被审核,不允许删除!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //删除前控制========================================= |
| | | string sql1 = "exec h_p_Kf_ICStockBill_BeforeDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql1, "h_p_Kf_ICStockBill_BeforeDelCtrl"); |
| | | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "删除失败!原因:删除前判断失败,请与网络管理人员联系"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "删除失败!原因:" + ds.Tables[0].Rows[0]["HRemark"].ToString(); ; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //================================================================================== |
| | | |
| | | |
| | | |
| | | oCN.BeginTran(); |
| | | |
| | | oCN.RunProc("delete from Kf_ICStockBillMain where HInterID = " + HInterID); |
| | | oCN.RunProc("delete from Kf_ICStockBillSub where HInterID= " + HInterID); |
| | | |
| | | //删除后控制================================================================================== |
| | | string sql2 = "exec h_p_Kf_ICStockBill_AfterDelCtrl " + BillOld.omodel.HInterID + ",'" + BillOld.omodel.HBillNo + "','" + user + "'"; |
| | | ds = oCN.RunProcReturn(sql2, "h_p_Kf_ICStockBill_AfterDelCtrl"); |
| | | if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | s = "删除后判断失败,请与网络管理人员联系"; |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "删除失败!原因:" + s; |
| | | objJsonResult.data = null; |
| | | oCN.RollBack(); |
| | | return objJsonResult; |
| | | } |
| | | if (ds.Tables[0].Rows[0]["HBack"].ToString() != "0") |
| | | { |
| | | s = ds.Tables[0].Rows[0]["HRemark"].ToString(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "删除失败!原因:" + s; |
| | | objJsonResult.data = null; |
| | | oCN.RollBack(); |
| | | return objJsonResult; |
| | | } |
| | | //============================================================================================== |
| | | |
| | | oCN.Commit(); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "删除成功"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | | /// <summary> |
| | | /// 委外入库单列表 |
| | |
| | | #endregion |
| | | |
| | | |
| | | #region 模具维修单保存/编辑 |
| | | #region 模具维修记录单保存/编辑 |
| | | /// <summary> |
| | | /// 保存模具维修单 |
| | | /// </summary> |
| | |
| | | string msg2 = sArray[0].ToString(); |
| | | string msg3 = sArray[1].ToString(); |
| | | string msg4 = sArray[2].ToString(); |
| | | string msg5 = sArray[3].ToString(); |
| | | |
| | | |
| | | string UserName = ""; |
| | |
| | | List<Model.ClsSb_MouldRepairWorkBillSub> ls = new List<Model.ClsSb_MouldRepairWorkBillSub>(); |
| | | ls = oListModels.getObjectByJson_Gy_MouldRepairWorkBillSub(msg3); |
| | | int i = 0; |
| | | foreach (Model.ClsSb_MouldRepairWorkBillSub oItemSub in ls) |
| | | foreach (Model.ClsSb_MouldRepairWorkBillSub oItem in ls) |
| | | { |
| | | |
| | | i++; |
| | | oItemSub.HEntryID = i; |
| | | oItem.HEntryID = i; |
| | | //oItemSub.HCloseMan = ""; //行关闭 |
| | | oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); |
| | | oItemSub.HCloseType = false; //关闭类型 |
| | | oItem.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); |
| | | oItem.HCloseType = false; //关闭类型 |
| | | //oItemSub.HRemark = ""; //备注 |
| | | oItemSub.HRelationQty = 0; //关联数量 |
| | | oItem.HRelationQty = 0; //关联数量 |
| | | //oItemSub.HRelationMoney = 0; //关联金额 |
| | | //oItemSub.HRepairID = 0; //维修项目 |
| | | //oItemSub.HRepairExplanation =""; //维修要求 |
| | | //oItemSub.HManagerID = 0; //负责人ID |
| | | //oItemSub.HMoney = 0; //维修费用 |
| | | oBill.DetailColl.Add(oItemSub); |
| | | oBill.DetailColl.Add(oItem); |
| | | |
| | | } |
| | | |
| | | //配件数据 |
| | | //按 },{来拆分数组 //去掉【和】 |
| | | msg5 = msg5.Substring(1, msg5.Length - 2); |
| | | msg5 = msg5.Replace("\\", ""); |
| | | msg5 = msg5.Replace("\n", ""); //\n |
| | | //msg2 = msg2.Replace("'", "’"); |
| | | List<Model.ClsSb_MouldRepairWorkBillSub_Item> ls1 = new List<Model.ClsSb_MouldRepairWorkBillSub_Item>(); |
| | | ls1 = oListModels.getObjectByJson_Gy_MouldRepairWorkBillSub_Item(msg5); |
| | | int j = 0; |
| | | foreach (Model.ClsSb_MouldRepairWorkBillSub_Item oItemSub in ls1) |
| | | { |
| | | |
| | | j++; |
| | | oItemSub.HEntryID = j; |
| | | //oItemSub.HCloseMan = ""; //行关闭 |
| | | oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); |
| | | oItemSub.HCloseType = false; //关闭类型 |
| | | //oItemSub.HRemark = ""; //备注 |
| | | oItemSub.HSourceInterID = 0; // 源单主内码 |
| | | oItemSub.HSourceEntryID = 0; //源单子内码 |
| | | //oItemSub.HSourceBillNo = ""; //源单单号 |
| | | //oItemSub.HSourceBillType = ""; //源单类型 |
| | | oItemSub.HRelationQty = 0; //关联数量 |
| | | //oItemSub.HRelationMoney = 0; //关联金额 |
| | | //HMaterID = "";//配件代码 |
| | | //HUnitID = "";//单位代码 |
| | | //HQty = "";//实际用量 |
| | | //HQtyMust = "";//单位用量 |
| | | //HRemark = "";//备注 |
| | | //oItemSub.HRepairID = 0; //维修项目 |
| | | //oItemSub.HRepairExplanation =""; //维修要求 |
| | | //oItemSub.HManagerID = 0; //负责人ID |
| | | //oItemSub.HMoney = 0; //维修费用 |
| | | oBill.DetailCol.Add(oItemSub); |
| | | |
| | | } |
| | | |
| | | //保存 |
| | | //保存完毕后处理 |
| | | bool bResult; |
| | |
| | | [HttpGet] |
| | | public object Sb_MouldRepairWorkBillListProjectDetai(string sqlWhere) |
| | | { |
| | | DataSet ds; |
| | | DataSet ds, ds1; |
| | | List<object> list = new List<object>(); |
| | | try |
| | | { |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | if (sqlWhere == null || sqlWhere.Equals("")) |
| | | { |
| | | //ds = oCN.RunProcReturn("select HRepairID,HRepairExplanation,HManagerID,HMoney,HRemark from Sc_MouldRepairWorkBillSub", "Sc_MouldRepairWorkBillSub"); |
| | | ds = oCN.RunProcReturn("select HRepairID, 子维修项目代码 HRepairCode,子维修项目 HRepairName,子维修要求 HRepairExplanation,HManagerSonID HManagerID,子负责人代码 HManagerCode,子负责人 HManagerName,维修费用 HMoney,表体备注 HRemark,源单主内码 HSourceInterID,源单子内码 HSourceEntryID,源单单号 HSourceBillNo,源单类型 HSourceBillType from h_v_Sc_MouldRepairWorkBillList_Edit", "h_v_Sc_MouldRepairWorkBillList_Edit"); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "获取信息成功!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | } |
| | | else |
| | | { |
| | | //string sql1 = "select HRepairID,HRepairExplanation,HManagerID,HMoney,HRemark from Sc_MouldRepairWorkBillSub where 1 = 1 "; |
| | | string sql1 = "select HRepairID,子维修项目代码 HRepairCode,子维修项目 HRepairName,子维修要求 HRepairExplanation,HManagerSonID HManagerID,子负责人代码 HManagerCode,子负责人 HManagerName,维修费用 HMoney,表体备注 HRemark,源单主内码 HSourceInterID,源单子内码 HSourceEntryID,源单单号 HSourceBillNo,源单类型 HSourceBillType from h_v_Sc_MouldRepairWorkBillList_Edit where 1 = 1 "; |
| | | string sql = sql1 + sqlWhere; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldRepairWorkBillList_Edit"); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "获取信息成功!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | } |
| | | |
| | | string sql = "select HRepairID,子维修项目代码 HRepairCode,子维修项目 HRepairName,子维修要求 HRepairExplanation,HManagerSonID HManagerID,子负责人代码 HManagerCode,子负责人 HManagerName,维修费用 HMoney,表体备注 HRemark,源单主内码 HSourceInterID,源单子内码 HSourceEntryID,源单单号 HSourceBillNo,源单类型 HSourceBillType from h_v_Sc_MouldRepairWorkBillList_Edit where 1 = 1 "+ sqlWhere; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldRepairWorkBillList_Edit"); |
| | | |
| | | string sql1 = "select 配件ID HMaterID, 配件代码 HMaterNumber,配件名称 HMaterName,规格型号 HMaterSpec,单位ID HUnitID,计量单位代码 HUnitNumber,计量单位名称 HUnitName,用量 HQty,标准用量 HQtyMust,子备注1 HRemark,规格型号 HMaterSpec from h_v_Sc_MouldRepairWorkBillSub_Item where 1 = 1 " + sqlWhere ; |
| | | ds1 = oCN.RunProcReturn(sql1, "h_v_Sc_MouldRepairWorkBillSub_Item"); |
| | | |
| | | list.Add(ds.Tables[0]); |
| | | list.Add(ds1.Tables[0]); |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "获取信息成功!"; |
| | | objJsonResult.data = null; |
| | | objJsonResult.list = list; |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "审核失败或者反审核失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 器具维修记录统计分析 |
| | | /// <summary> |
| | | /// 器具维修记录统计分析 列表 |
| | | ///参数:string sql。 |
| | | ///返回值:object。 |
| | | /// </summary> |
| | | [Route("Sb_MouldRepairWorkBill/Sb_MouldRepairWorkBill")] |
| | | [HttpGet] |
| | | public object Sb_MouldRepairWorkBill(string DateYear, string HType, string user) |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | |
| | | if (DateYear == null || DateYear.Equals("")) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "请选择有效年份"; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | ds = oCN.RunProcReturn("exec h_p_Sb_MouldRepairWorkBill'" + DateYear + "','" + HType + "'", "h_p_Sb_MouldRepairWorkBill"); |
| | | } |
| | | |
| | | //添加列名 |
| | | foreach (DataColumn col in ds.Tables[0].Columns) |
| | | { |
| | | Type dataType = col.DataType; |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; |
| | | columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = columnNameList; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | |
| | | string msg2 = sArray[0].ToString(); |
| | | string msg3 = sArray[1].ToString(); |
| | | string msg4 = sArray[2].ToString(); |
| | | string msg5 = sArray[3].ToString(); |
| | | |
| | | |
| | | string UserName = ""; |
| | |
| | | } |
| | | oBill.omodel = oItem; |
| | | } |
| | | |
| | | //保养项表体数据 |
| | | //按 },{来拆分数组 //去掉【和】 |
| | | msg5 = msg5.Substring(1, msg5.Length - 2); |
| | | msg5 = msg5.Replace("\\", ""); |
| | | msg5 = msg5.Replace("\n", ""); //\n |
| | | //msg2 = msg2.Replace("'", "’"); |
| | | List<Model.ClsSc_MouldMaintainPlanBillSub_Item> ls1 = new List<Model.ClsSc_MouldMaintainPlanBillSub_Item>(); |
| | | ls1 = oListModels.getObjectByJson_Gy_MouldMaintainPlanBillSub_Item(msg5); |
| | | int j = 0; |
| | | foreach (Model.ClsSc_MouldMaintainPlanBillSub_Item item in ls1) |
| | | { |
| | | |
| | | j++; |
| | | item.HEntryID = j; |
| | | //oItemSub.HCloseMan = ""; //行关闭 |
| | | item.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); |
| | | item.HCloseType = false; //关闭类型 |
| | | //oItemSub.HRemark = ""; //备注 |
| | | item.HSourceInterID = 0; // 源单主内码 |
| | | item.HSourceEntryID = 0; //源单子内码 |
| | | //oItemSub.HSourceBillNo = ""; //源单单号 |
| | | //oItemSub.HSourceBillType = ""; //源单类型 |
| | | item.HRelationQty = 0; //关联数量 |
| | | oBill.DetailCol.Add(item); |
| | | |
| | | } |
| | | |
| | | //表体数据 |
| | | //按 },{来拆分数组 //去掉【和】 |
| | | msg3 = msg3.Substring(1, msg3.Length - 2); |
| | |
| | | [HttpGet] |
| | | public object Sc_MouldMaintainPlanBillListProjectDetai(string sqlWhere) |
| | | { |
| | | DataSet ds; |
| | | DataSet ds, ds1; |
| | | List<object> list = new List<object>(); |
| | | |
| | | try |
| | | { |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | if (sqlWhere == null || sqlWhere.Equals("")) |
| | | { |
| | | ds = oCN.RunProcReturn("select a.HMaterID,m.HNumber HMaterNumber,m.HName HMaterName,a.HUnitID,u.HNumber HUnitNumber,u.HName HUnitName,a.HQty,a.HQtyMust,a.HRemark from Sc_MouldMaintainPlanBillSub a left join Gy_Unit u on a.HUnitID=u.HItemID left join h_v_IF_Material m on a.HMaterID=m.HItemID", "Sc_MouldMaintainPlanBillSub"); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "获取信息成功!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | } |
| | | else |
| | | { |
| | | string sql1 = "select a.HMaterID,m.HNumber HMaterNumber,m.HName HMaterName,a.HUnitID,u.HNumber HUnitNumber,u.HName HUnitName,a.HQty,a.HQtyMust,a.HRemark from Sc_MouldMaintainPlanBillSub a left join Gy_Unit u on a.HUnitID=u.HItemID left join h_v_IF_Material m on a.HMaterID=m.HItemID where 1 = 1 "; |
| | | string sql = sql1 + sqlWhere; |
| | | ds = oCN.RunProcReturn(sql, "Sc_MouldMaintainPlanBillSub"); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "获取信息成功!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | } |
| | | //获取保养项目编辑数据 |
| | | string sql = "select 保养项目ID HMaintainItemID, 保养项目代码 HMaintainItemNumber,保养项目 HMaintainItem,保养部位 HMaintainPart,具体要求 HClaim,负责人ID,负责人代码 HManagerNumber,负责人名称 HManagerName,子备注2 HRemark,HMouldMaintainRuleID,HEquipDotCheckNo from h_v_Sc_MouldMaintainPlanBillSub_Item where 1 = 1 " + sqlWhere + ""; |
| | | |
| | | ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldMaintainPlanBillSub_Item"); |
| | | //获取配件项目编辑数据 |
| | | string sql1 = "select 配件ID HMaterID, 配件代码 HMaterNumber,配件名称 HMaterName,单位ID HUnitID,计量单位代码 HUnitNumber,计量单位名称 HUnitName,用量 HQty,标准用量 HQtyMust,子备注1 HRemark,规格型号 HMaterSpec from h_v_Sc_MouldMaintainPlanBillSub where 1 = 1 " + sqlWhere + ""; |
| | | ds1 = oCN.RunProcReturn(sql1, "h_v_Sc_MouldMaintainPlanBillSub"); |
| | | |
| | | list.Add(ds.Tables[0]); |
| | | list.Add(ds1.Tables[0]); |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "获取信息成功!"; |
| | | objJsonResult.data = null; |
| | | objJsonResult.list = list; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region 器具保养记录统计分析 |
| | | /// <summary> |
| | | /// 器具维修记录统计分析 列表 |
| | | ///参数:string sql。 |
| | | ///返回值:object。 |
| | | /// </summary> |
| | | [Route("Sb_MouldRepairWorkBill/Sc_MouldMaintainBillMain")] |
| | | [HttpGet] |
| | | public object Sc_MouldMaintainBillMain(string DateYear, string HType, string user) |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | |
| | | if (DateYear == null || DateYear.Equals("")) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "请选择有效年份"; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | ds = oCN.RunProcReturn("exec h_p_Sc_MouldMaintainBillMain'" + DateYear + "','" + HType + "'", "h_p_Sc_MouldMaintainBillMain"); |
| | | } |
| | | |
| | | //添加列名 |
| | | foreach (DataColumn col in ds.Tables[0].Columns) |
| | | { |
| | | Type dataType = col.DataType; |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; |
| | | columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = columnNameList; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | #endregion |
| | | |
| | | #region 模具保养记录表 |
| | |
| | | string msg2 = sArray[0].ToString(); |
| | | string msg3 = sArray[1].ToString(); |
| | | string msg4 = sArray[2].ToString(); |
| | | //string msg5 = sArray[3].ToString(); |
| | | |
| | | string UserName = ""; |
| | | ListModels oListModels = new ListModels(); |
| | |
| | | { |
| | | //oItem.HMaker = ""; |
| | | UserName = oItem.HMaker; //制单人 |
| | | oItem.HMaker = msg4; |
| | | oItem.HBillType = "3821"; |
| | | oItem.HBillSubType = "3821"; |
| | | |
| | |
| | | oBill.DetailColl.Add(oItemSub); |
| | | |
| | | } |
| | | |
| | | ////配件项表体数据 |
| | | ////按 },{来拆分数组 //去掉【和】 |
| | | //msg5 = msg5.Substring(1, msg5.Length - 2); |
| | | //msg5 = msg5.Replace("\\", ""); |
| | | //msg5 = msg5.Replace("\n", ""); //\n |
| | | // //msg2 = msg2.Replace("'", "’"); |
| | | //List<Model.ClsSc_MouldDotCheckBillSub_Item> ls1 = new List<Model.ClsSc_MouldDotCheckBillSub_Item>(); |
| | | //ls1 = oListModels.getObjectByJson_Sc_MouldDotCheckBillSub_Item(msg5); |
| | | //int j = 0; |
| | | //foreach (Model.ClsSc_MouldDotCheckBillSub_Item oItemSub in ls1) |
| | | //{ |
| | | |
| | | // j++; |
| | | // oItemSub.HEntryID = j; |
| | | // //oItemSub.HCloseMan = ""; //行关闭 |
| | | // oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); |
| | | // oItemSub.HCloseType = false; //关闭类型 |
| | | |
| | | // oItemSub.HSourceInterID = 0; // 源单主内码 |
| | | // oItemSub.HSourceEntryID = 0; //源单子内码 |
| | | |
| | | // oItemSub.HRelationQty = 0; //关联数量 |
| | | // oBill.DetailCol.Add(oItemSub); |
| | | //} |
| | | |
| | | //保存 |
| | | //保存完毕后处理 |
| | | bool bResult; |
| | |
| | | [HttpGet] |
| | | public object Sc_MouldDotCheckBillListProjectDetai(string sqlWhere) |
| | | { |
| | | DataSet ds; |
| | | DataSet ds, ds1; |
| | | List<object> list = new List<object>(); |
| | | string Swhere = ""; |
| | | try |
| | | { |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | if (sqlWhere == null || sqlWhere.Equals("")) |
| | | { |
| | | ds = oCN.RunProcReturn("select HDotCheckItemID,点检项目 HDotCheckItem,点检部位 HDotCheckPart,具体要求 HClaim,表体备注 HRemark,HManagerID,负责人代码 HManagerNumber,负责人 HManagerName from h_v_Sc_MouldDotCheckBillList", "h_v_Sc_MouldDotCheckBillList"); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "获取信息成功!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | } |
| | | else |
| | | { |
| | | string sql1 = "select HDotCheckItemID,点检项目 HDotCheckItem,点检部位 HDotCheckPart,具体要求 HClaim,表体备注 HRemark,HManagerID,负责人代码 HManagerNumber,负责人 HManagerName from h_v_Sc_MouldDotCheckBillList where 1 = 1 "; |
| | | string sql = sql1 + sqlWhere; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldDotCheckBillList"); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "获取信息成功!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | } |
| | | //获取点检项目编辑数据 |
| | | ds = oCN.RunProcReturn("select * from h_v_Sc_MouldDotCheckBill_Edit where 1=1 " + sqlWhere, "h_v_Sc_MouldDotCheckBill_Edit"); |
| | | //获取配件项目编辑数据 |
| | | ds1 = oCN.RunProcReturn(@"select b.HMaterID, mt.Hnumber HMaterNumber ,mt.HName HMaterName, b.HUnitID |
| | | ,u2.hnumber HUnitNumber,u2.HName HUnitName,b.HQty,b.HQtyMust,b.HRemark |
| | | from Sc_MouldDotCheckBillSub_Item b |
| | | left join Gy_Material mt on b.HMaterID=mt.HItemID |
| | | left join h_v_IF_Unit u2 on b.HUnitID=u2.HItemID where 1=1 " + sqlWhere, "Sc_MouldDotCheckBillSub_Item"); |
| | | list.Add(ds.Tables[0]); |
| | | list.Add(ds1.Tables[0]); |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "获取信息成功!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = list; |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | return objJsonResult; |
| | | } |
| | | #endregion |
| | | |
| | | #region[模具点检记录表选择点检计划带出表格数据] |
| | | [Route("Sc_MouldDotCheckBill/Sc_MouldDotCheckSubBillListByPlan")] |
| | | [HttpGet] |
| | | public object Sc_MouldDotCheckSubBillListByPlan(string HPlanInterID) |
| | | { |
| | | DataSet ds; |
| | | try |
| | | { |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | string sql1 = "select hsubid HDotCheckItemID,点检项目 HDotCheckItem,点检部位 HDotCheckPart,具体要求 HClaim,表体备注 HRemark,HManagerID,负责人代码 HManagerNumber,负责人 HManagerName from h_v_Sc_MouldDotCheckPlanBillList where hmainid =" + HPlanInterID; |
| | | ds = oCN.RunProcReturn(sql1, "h_v_Sc_MouldDotCheckPlanBillList"); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "获取信息成功!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "没有返回任何记录!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | } |
| | | return objJsonResult; |
| | | } |
| | | #endregion |
| | | #region [模具点检记录表删除功能] |
| | | /// <summary> |
| | | /// 模具点检记录删除功能 |
| | |
| | | string msg2 = sArray[0].ToString(); |
| | | string msg3 = sArray[1].ToString(); |
| | | string msg4 = sArray[2].ToString(); |
| | | //string msg5 = sArray[3].ToString(); |
| | | |
| | | |
| | | string UserName = ""; |
| | |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | DBUtility.ClsPub.CurUserName = msg4; |
| | | DAL.ClsSc_MouldDotCheckPlanBill oBill = new DAL.ClsSc_MouldDotCheckPlanBill(); |
| | | List<Model.ClsSc_MouldDotCheckPlanBillMain> lsmain = new List<Model.ClsSc_MouldDotCheckPlanBillMain>(); |
| | | msg2 = msg2.Replace("\\", ""); |
| | |
| | | { |
| | | //oItem.HMaker = ""; |
| | | UserName = oItem.HMaker; //制单人 |
| | | oItem.HBillType = "3821"; |
| | | oItem.HBillSubType = "3821"; |
| | | oItem.HBillType = "3820"; |
| | | oItem.HBillSubType = "3820"; |
| | | |
| | | //oItem.HInterID =0; |
| | | //oItem.HBillNo = ""; |
| | |
| | | } |
| | | oBill.omodel = oItem; |
| | | } |
| | | //表体数据 |
| | | //点检项目表体数据 |
| | | //按 },{来拆分数组 //去掉【和】 |
| | | msg3 = msg3.Substring(1, msg3.Length - 2); |
| | | msg3 = msg3.Replace("\\", ""); |
| | |
| | | oBill.DetailColl.Add(oItemSub); |
| | | |
| | | } |
| | | |
| | | ////配件项表体数据 |
| | | ////按 },{来拆分数组 //去掉【和】 |
| | | //msg5 = msg5.Substring(1, msg5.Length - 2); |
| | | //msg5 = msg5.Replace("\\", ""); |
| | | //msg5 = msg5.Replace("\n", ""); //\n |
| | | // //msg2 = msg2.Replace("'", "’"); |
| | | //List<Model.ClsSc_MouldDotCheckPlanBillSub_Item> ls1 = new List<Model.ClsSc_MouldDotCheckPlanBillSub_Item>(); |
| | | //ls1 = oListModels.getObjectByJson_Sc_MouldDotCheckPlanBillSub_Item(msg5); |
| | | //int j = 0; |
| | | //foreach (Model.ClsSc_MouldDotCheckPlanBillSub_Item oItemSub in ls1) |
| | | //{ |
| | | |
| | | // j++; |
| | | // oItemSub.HEntryID = j; |
| | | // //oItemSub.HCloseMan = ""; //行关闭 |
| | | // oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); |
| | | // oItemSub.HCloseType = false; //关闭类型 |
| | | |
| | | // oItemSub.HSourceInterID = 0; // 源单主内码 |
| | | // oItemSub.HSourceEntryID = 0; //源单子内码 |
| | | |
| | | // oItemSub.HRelationQty = 0; //关联数量 |
| | | // oBill.DetailCol.Add(oItemSub); |
| | | //} |
| | | |
| | | //保存 |
| | | //保存完毕后处理 |
| | | bool bResult; |
| | |
| | | [HttpGet] |
| | | public object Sc_MouldDotCheckPlanBillListProjectDetai(string sqlWhere) |
| | | { |
| | | DataSet ds; |
| | | DataSet ds, ds1; |
| | | List<object> list = new List<object>(); |
| | | string Swhere = ""; |
| | | try |
| | | { |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | if (sqlWhere == null || sqlWhere.Equals("")) |
| | | { |
| | | ds = oCN.RunProcReturn("select HDotCheckItem, HDotCheckPart , HClaim, a.HRemark,a.HManagerID,e.HNumber HManagerCode,e.HName HManagerName from Sc_MouldDotCheckPlanBillSub a left join Gy_Employee e on a.HManagerID=e.HItemID", "Sc_MouldDotCheckPlanBillSub"); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "获取信息成功!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | } |
| | | else |
| | | { |
| | | string sql1 = "select HDotCheckItem, HDotCheckPart , HClaim, a.HRemark,a.HManagerID,e.HNumber HManagerCode,e.HName HManagerName from Sc_MouldDotCheckPlanBillSub a left join Gy_Employee e on a.HManagerID=e.HItemID where 1 = 1 "; |
| | | string sql = sql1 + sqlWhere; |
| | | ds = oCN.RunProcReturn(sql, "Sc_MouldDotCheckPlanBillSub"); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "获取信息成功!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | } |
| | | //获取点检项目编辑数据 |
| | | ds = oCN.RunProcReturn(@"select * from h_v_Sc_MouldDotCheckPlanBill_Edit |
| | | where 1=1 " + sqlWhere, "Sc_MouldDotCheckPlanBillSub"); |
| | | ////获取配件项目编辑数据 |
| | | //ds1 = oCN.RunProcReturn(@"select b.HMaterID, mt.Hnumber HMaterNumber ,mt.HName HMaterName, b.HUnitID |
| | | // ,u2.hnumber HUnitNumber,u2.HName HUnitName,b.HQty,b.HQtyMust,b.HRemark |
| | | // from Sc_MouldDotCheckPlanBillSub_Item b |
| | | // left join Gy_Material mt on b.HMaterID=mt.HItemID |
| | | // left join h_v_IF_Unit u2 on b.HUnitID=u2.HItemID where 1=1 " + sqlWhere, "Sc_MouldDotCheckPlanBillSub_Item"); |
| | | list.Add(ds.Tables[0]); |
| | | //list.Add(ds1.Tables[0]); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "获取信息成功!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = list; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | |
| | | #endregion |
| | | |
| | | |
| | | #region 根据器具条码查找器具档案信息PDA |
| | | [Route("QJ_PDA_MouldDotCheckBill/txtHBarCode_KeyDown")] |
| | | [HttpGet] |
| | | public object txtHBarCode_KeyDown(string HBarCode) |
| | | { |
| | | try |
| | | { |
| | | if (HBarCode == null || HBarCode.Equals("")) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "条形码不能为空!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //得到信息 |
| | | ds = oCN.RunProcReturn("select top 1 * from Gy_MouldFileMain where HNumber= '" + HBarCode + "'", "Gy_MouldFileMain"); |
| | | //写入信息 |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "未查询到器具信息!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 模具报废入库单 |
| | | |
| | |
| | | ds = oCN.RunProcReturn(string.Format(@"SELECT HMaterID,模具代码 HMaterCode,模具名称 HMaterName,规格型号 HMaterSpec,HPropertyID,辅助属性代码 HPropertyCode,辅助属性名称 HPropertyName, |
| | | HSecUnitID, 辅助计量单位代码 HSecUnitCode, 辅助计量单位名称 HSecUnitName, HUnitID, 计量单位代码 HUnitCode, 计量单位名称 HUnitName, 批次 HBatchNo, |
| | | 设计寿命 HDesignLife, 剩余寿命 HLeaveLife, 使用寿命 HUseLife, 实收数量 HQty, 单价 HPrice, 金额 HMoney, HWHID, 收料仓库代码 HWHCode, 收料仓库名称 HWHName, |
| | | HSPID, 仓位代码 HSPCode, 仓位名称 HSPName, 备注 HRemark,HStockOrgID |
| | | HSPID, 仓位代码 HSPCode, 仓位名称 HSPName, 子备注 HRemark,HStockOrgID |
| | | FROM h_v_Sc_MouldScrapInHouseBillList"), "h_v_Sc_MouldScrapInHouseBillList"); |
| | | |
| | | } |
| | |
| | | string sql1 = string.Format(@"SELECT HMaterID,模具代码 HMaterCode,模具名称 HMaterName,规格型号 HMaterSpec,HPropertyID,辅助属性代码 HPropertyCode,辅助属性名称 HPropertyName, |
| | | HSecUnitID, 辅助计量单位代码 HSecUnitCode, 辅助计量单位名称 HSecUnitName, HUnitID, 计量单位代码 HUnitCode, 计量单位名称 HUnitName, 批次 HBatchNo, |
| | | 设计寿命 HDesignLife, 剩余寿命 HLeaveLife, 使用寿命 HUseLife, 实收数量 HQty, 单价 HPrice, 金额 HMoney, HWHID, 收料仓库代码 HWHCode, 收料仓库名称 HWHName, |
| | | HSPID, 仓位代码 HSPCode, 仓位名称 HSPName, 备注 HRemark,HStockOrgID |
| | | HSPID, 仓位代码 HSPCode, 仓位名称 HSPName, 子备注 HRemark,HStockOrgID |
| | | FROM h_v_Sc_MouldScrapInHouseBillList where 1 = 1 "); |
| | | string sql = sql1 + sqlWhere; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldScrapInHouseBillList"); |
| | |
| | | { |
| | | // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | string sql = string.Format($"exec h_p_Sc_MouldChangeFileStatus 'in','{oBill.omodel.HInterID.ToString()}' "); |
| | | oCn.RunProc(sql); |
| | | } |
| | | else |
| | | { |
| | | bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | //修改成功 |
| | | //string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID 1,{oBill.omodel.HInterID.ToString()},' ' "); |
| | | string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID "); |
| | | oCn.RunProc(sql); |
| | | } |
| | | if (bResult) |
| | | { |
| | | string sql = $"exec h_p_Sc_MouldChangeFileStatus 'in','{oBill.omodel.HInterID.ToString()}' "; |
| | | oCn.RunProc(sql); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "保存成功!"; |
| | |
| | | string sql1 = string.Format(@"select * from h_v_Sc_MouldScrapOutHouseBillList where 库存组织='" + Organization + "'"); |
| | | if (sWhere == null || sWhere.Equals("")) |
| | | { |
| | | return new SQLHelper.ClsCN().RunProcReturn(sql1 + "order by hmainid desc", "h_v_Sc_MouldScrapOutHouseBillList"); |
| | | return new SQLHelper.ClsCN().RunProcReturn(sql1 + " order by 制单日期 desc", "h_v_Sc_MouldScrapOutHouseBillList"); |
| | | } |
| | | else |
| | | { |
| | | string sql = sql1 + sWhere + "order by hmainid desc"; |
| | | string sql = sql1 + sWhere + " order by 制单日期 desc"; |
| | | return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Sc_MouldScrapOutHouseBillList"); |
| | | } |
| | | } |
| | |
| | | { |
| | | // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | string sql = string.Format($"exec h_p_Sc_MouldChangeFileStatus 'out','{oBill.omodel.HInterID.ToString()}' "); |
| | | oCn.RunProc(sql); |
| | | } |
| | | else |
| | | { |
| | | bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | //修改成功 |
| | | //string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID 1,{oBill.omodel.HInterID.ToString()},' ' "); |
| | | string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID "); |
| | | oCn.RunProc(sql); |
| | | } |
| | | if (bResult) |
| | | { |
| | | string sql = $"exec h_p_Sc_MouldChangeFileStatus 'out','{oBill.omodel.HInterID.ToString()}' "; |
| | | oCn.RunProc(sql); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "保存成功!"; |
| | |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //删除前查找当前单据的所有器具ID |
| | | //string swhere = ""; |
| | | //DataSet ds = oCn.RunProcReturn("select HMaterID from Sc_MouldStockBillSub where HinterID=" + HInterID, "Sc_MouldStockBillSub"); |
| | | //for (var i = 0; i < ds.Tables[0].Rows.Count; i++) |
| | | //{ |
| | | // swhere = swhere + ds.Tables[0].Rows[i]["HMaterID"].ToString()+","; |
| | | //} |
| | | //swhere = swhere.Substring(0, swhere.Length - 1); |
| | | bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | if (IsDete) |
| | | { |
| | | //删除成功修改器具档案位置 |
| | | //string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID 0,0,'{swhere}' "); |
| | | string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID "); |
| | | oCn.RunProc(sql); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; |
| | |
| | | string sql1 = string.Format(@"select * from h_v_Sc_MouldProdBackBillList where 库存组织='" + Organization + "'"); |
| | | if (sWhere == null || sWhere.Equals("")) |
| | | { |
| | | return new SQLHelper.ClsCN().RunProcReturn(sql1 + "order by hmainid desc", "h_v_Sc_MouldProdBackBillList"); |
| | | return new SQLHelper.ClsCN().RunProcReturn(sql1 + "order by 制单日期 desc", "h_v_Sc_MouldProdBackBillList"); |
| | | } |
| | | else |
| | | { |
| | | string sql = sql1 + sWhere + "order by hmainid desc"; |
| | | string sql = sql1 + sWhere + "order by 制单日期 desc"; |
| | | return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Sc_MouldProdBackBillList"); |
| | | } |
| | | |
| | |
| | | ds = oCN.RunProcReturn(string.Format(@"SELECT HMaterID,模具代码 HMaterCode,模具名称 HMaterName,规格型号 HMaterSpec,批次 HBatchNo, |
| | | 设计寿命 HDesignLife, 剩余寿命 HLeaveLife, 累积使用寿命 HUseLife, 应发数量 HQtyMust, 实发数量 HQty, |
| | | 单价 HPrice, 金额 HMoney,收料仓库ID HWHID, 收料仓库代码 HWHCode, 收料仓库 HWHName,HSPID, |
| | | 仓位代码 HSPCode, 仓位 HSPName,表体备注 HRemark,HStockOrgID,HUnitID,计量单位代码,计量单位 FROM h_v_Sc_MouldProdBackBillList"), "h_v_Sc_MouldProdBackBillList"); |
| | | 仓位代码 HSPCode, 仓位 HSPName,表体备注 HRemark,HStockOrgID,HUnitID,计量单位代码 HUnitCode,计量单位 HUnitName FROM h_v_Sc_MouldProdBackBillList"), "h_v_Sc_MouldProdBackBillList"); |
| | | |
| | | } |
| | | else |
| | |
| | | string sql1 = string.Format(@"SELECT HMaterID,模具代码 HMaterCode,模具名称 HMaterName,规格型号 HMaterSpec,批次 HBatchNo, |
| | | 设计寿命 HDesignLife, 剩余寿命 HLeaveLife, 累积使用寿命 HUseLife, 应发数量 HQtyMust, 实发数量 HQty, |
| | | 单价 HPrice, 金额 HMoney,收料仓库ID HWHID, 收料仓库代码 HWHCode, 收料仓库 HWHName,HSPID, |
| | | 仓位代码 HSPCode, 仓位 HSPName,表体备注 HRemark,HStockOrgID,HUnitID,计量单位代码,计量单位 FROM h_v_Sc_MouldProdBackBillList where 1 = 1 "); |
| | | 仓位代码 HSPCode, 仓位 HSPName,表体备注 HRemark,HStockOrgID,HUnitID,计量单位代码 HUnitCode,计量单位 HUnitName FROM h_v_Sc_MouldProdBackBillList where 1 = 1 "); |
| | | string sql = sql1 + sqlWhere; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldProdBackBillList"); |
| | | |
| | |
| | | { |
| | | // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | |
| | | string sql1 = string.Format($"exec h_p_Sc_MouldChangeFileStatus 'in','{oBill.omodel.HInterID.ToString()}' "); |
| | | oCn.RunProc(sql1); |
| | | } |
| | | else |
| | | { |
| | | bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | //修改成功 |
| | | //string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID 1,{oBill.omodel.HInterID.ToString()},' ' "); |
| | | string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID "); |
| | | oCn.RunProc(sql); |
| | | } |
| | | if (bResult) |
| | | { |
| | | string sql = $"exec h_p_Sc_MouldProdBackBillList '{oBill.omodel.HBillNo}' "; |
| | | string sql =string.Format($"exec h_p_Sc_MouldProdBackBillList '{oBill.omodel.HBillNo}' ") ; |
| | | oCn.RunProc(sql); |
| | | string sql1 = $"exec h_p_Sc_MouldChangeFileStatus 'in','{oBill.omodel.HInterID.ToString()}' "; |
| | | oCn.RunProc(sql1); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "保存成功!"; |
| | |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //删除前查找当前单据的所有器具ID |
| | | //string swhere = ""; |
| | | //DataSet ds = oCn.RunProcReturn("select HMaterID from Sc_MouldStockBillSub where HinterID=" + HInterID, "Sc_MouldStockBillSub"); |
| | | //for (var i = 0; i < ds.Tables[0].Rows.Count; i++) |
| | | //{ |
| | | // swhere = swhere + ds.Tables[0].Rows[i]["HMaterID"].ToString()+","; |
| | | //} |
| | | //swhere = swhere.Substring(0, swhere.Length - 1); |
| | | bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | if (IsDete) |
| | | { |
| | | //删除成功修改器具档案位置 |
| | | //string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID 0,0,'{swhere}' "); |
| | | string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID "); |
| | | oCn.RunProc(sql); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; |
| | |
| | | if (sWhere == null || sWhere.Equals("")) |
| | | { |
| | | Log.LogInfo(sql1); |
| | | return new SQLHelper.ClsCN().RunProcReturn(sql1 + "order by hmainid desc", "h_v_Sc_MouldProdOutHouseBillList"); |
| | | return new SQLHelper.ClsCN().RunProcReturn(sql1 + "order by 制单日期 desc", "h_v_Sc_MouldProdOutHouseBillList"); |
| | | } |
| | | else |
| | | { |
| | | string sql = sql1 + sWhere + "order by hmainid desc"; |
| | | string sql = sql1 + sWhere + "order by 制单日期 desc"; |
| | | return new SQLHelper.ClsCN().RunProcReturn(sql, "h_v_Sc_MouldProdOutHouseBillList"); |
| | | } |
| | | |
| | |
| | | ds = oCN.RunProcReturn(string.Format(@"SELECT HMaterID,模具代码 HMaterCode,模具名称 HMaterName,规格型号 HMaterSpec,批次 HBatchNo, |
| | | 设计寿命 HDesignLife, 剩余寿命 HLeaveLife, 累积使用寿命 HUseLife, 应发数量 HQtyMust, 实发数量 HQty, |
| | | 单价 HPrice, 金额 HMoney,HWHSonID HWHID, 发料仓库代码 HWHCode, 发料仓库 HWHName,HSPID, |
| | | 仓位代码 HSPCode, 仓位 HSPName,表体备注 HRemark,HStockOrgID,HUnitID,计量单位代码,计量单位 FROM h_v_Sc_MouldProdOutHouseBillList"), "h_v_Sc_MouldProdOutHouseBillList"); |
| | | 仓位代码 HSPCode, 仓位 HSPName,表体备注 HRemark,HStockOrgID,HUnitID,计量单位代码 HUnitCode,计量单位 HUnitName FROM h_v_Sc_MouldProdOutHouseBillList"), "h_v_Sc_MouldProdOutHouseBillList"); |
| | | |
| | | } |
| | | else |
| | |
| | | string sql1 = string.Format(@"SELECT HMaterID,模具代码 HMaterCode,模具名称 HMaterName,规格型号 HMaterSpec,批次 HBatchNo, |
| | | 设计寿命 HDesignLife, 剩余寿命 HLeaveLife, 累积使用寿命 HUseLife, 应发数量 HQtyMust, 实发数量 HQty, |
| | | 单价 HPrice, 金额 HMoney,HWHSonID HWHID, 发料仓库代码 HWHCode, 发料仓库 HWHName,HSPID, |
| | | 仓位代码 HSPCode, 仓位 HSPName,表体备注 HRemark,HStockOrgID,HUnitID,计量单位代码,计量单位 FROM h_v_Sc_MouldProdOutHouseBillList where 1 = 1 "); |
| | | 仓位代码 HSPCode, 仓位 HSPName,表体备注 HRemark,HStockOrgID,HUnitID,计量单位代码 HUnitCode,计量单位 HUnitName FROM h_v_Sc_MouldProdOutHouseBillList where 1 = 1 "); |
| | | string sql = sql1 + sqlWhere; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldProdOutHouseBillList"); |
| | | } |
| | |
| | | { |
| | | // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | string sql = string.Format($"exec h_p_Sc_MouldChangeFileStatus 'out','{oBill.omodel.HInterID.ToString()}' "); |
| | | oCn.RunProc(sql); |
| | | } |
| | | else |
| | | { |
| | | bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | //修改成功 |
| | | //string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID 1,{oBill.omodel.HInterID.ToString()},' ' "); |
| | | string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID "); |
| | | oCn.RunProc(sql); |
| | | } |
| | | if (bResult) |
| | | { |
| | | string sql = $"exec h_p_Sc_MouldChangeFileStatus 'out','{oBill.omodel.HInterID.ToString()}' "; |
| | | oCn.RunProc(sql); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "保存成功!"; |
| | |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //删除前查找当前单据的所有器具ID |
| | | //string swhere = ""; |
| | | //DataSet ds = oCn.RunProcReturn("select HMaterID from Sc_MouldStockBillSub where HinterID=" + HInterID, "Sc_MouldStockBillSub"); |
| | | //for (var i = 0; i < ds.Tables[0].Rows.Count; i++) |
| | | //{ |
| | | // swhere = swhere + ds.Tables[0].Rows[i]["HMaterID"].ToString() + ","; |
| | | //} |
| | | //swhere = swhere.Substring(0, swhere.Length - 1); |
| | | bool IsDete = oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | if (IsDete) |
| | | { |
| | | //删除成功修改器具档案位置 |
| | | // string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID 0,0,'{swhere}' "); |
| | | string sql = string.Format($"exec h_p_Sc_MouldChangeNowWHID "); |
| | | oCn.RunProc(sql); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = DBUtility.ClsPub.sExeReturnInfo; |
| | |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | |
| | | if (!DBUtility.ClsPub.Security_Log("Sc_MouldLifeChangeBillList", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | |
| | | |
| | | ds = Sc_GetMouldLifeChangeBill(sWhere); |
| | | |
| | | //添加列名 |
| | | foreach (DataColumn col in ds.Tables[0].Columns) |
| | | { |
| | | Type dataType = col.DataType; |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; |
| | | columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 |
| | | } |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "返回记录成功!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = columnNameList; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception ex) |
| | |
| | | ds = oCN.RunProcReturn(string.Format(@"SELECT HMaterID,模具代码 HMaterCode,模具 HMaterName,规格型号 HMaterSpec,HPropertyID,辅助属性代码 HPropertyCode,辅助属性 HPropertyName, |
| | | HSecUnitID, 辅助计量单位代码 HSecUnitCode, 辅助计量单位 HSecUnitName,换算率 HSecUnitRate, |
| | | HUnitID, 计量单位代码 HUnitCode, 计量单位 HUnitName, |
| | | 设计寿命 HDesignLife, 原剩余寿命 HLeaveLife, 新剩余寿命 HNewLife,表体备注 HRemark |
| | | 设计寿命 HDesignLife, 原剩余寿命 HLeaveLife, 新剩余寿命 HNewLeaveLife,表体备注 HRemark |
| | | FROM h_v_Sc_MouldLifeChangeBillList_Edit"), "h_v_Sc_MouldLifeChangeBillList_Edit"); |
| | | |
| | | objJsonResult.code = "0"; |
| | |
| | | string sql1 = string.Format(@"SELECT HMaterID,模具代码 HMaterCode,模具 HMaterName,规格型号 HMaterSpec,HPropertyID,辅助属性代码 HPropertyCode,辅助属性 HPropertyName, |
| | | HSecUnitID, 辅助计量单位代码 HSecUnitCode, 辅助计量单位 HSecUnitName,换算率 HSecUnitRate, |
| | | HUnitID, 计量单位代码 HUnitCode, 计量单位 HUnitName, |
| | | 设计寿命 HDesignLife, 原剩余寿命 HLeaveLife, 新剩余寿命 HNewLife,表体备注 HRemark |
| | | 设计寿命 HDesignLife, 原剩余寿命 HLeaveLife, 新剩余寿命 HNewLeaveLife,表体备注 HRemark |
| | | FROM h_v_Sc_MouldLifeChangeBillList_Edit where 1 = 1 "); |
| | | string sql = sql1 + sqlWhere; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Sc_MouldLifeChangeBillList_Edit"); |