| | |
| | | //获取系统参数 |
| | | Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); |
| | | public DBUtility.ClsPub.Enum_BillStatus BillStatus; |
| | | public DAL.ClsXs_SeOutStockBackBill BillOld = new DAL.ClsXs_SeOutStockBackBill(); |
| | | |
| | | private json objJsonResult = new json(); |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | |
| | | { |
| | | try |
| | | { |
| | | //判断是否有查询权限 |
| | | List < object > columnNameList = new List<object>() |
| | | ; //判断是否有查询权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Xs_SeOutStockBackBillQuery", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | |
| | | string sql = sql1 + sWhere+ " order by hmainid desc"; |
| | | ds = oCN.RunProcReturn(sql, "h_v_IF_SeOutStockBackBillList"); |
| | | } |
| | | foreach (DataColumn col in ds.Tables[0].Columns)//遍历ds中第一个表(Tables[0])的所有列(Columns)每次循环中,col变量会持有当前列的引用 |
| | | { |
| | | Type dataType = col.DataType; //获取当前数据类型传入 自定义变量datadataType |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; //字符串拼接 // 将列名和数据类型信息拼接成一个JSON格式的字符串 |
| | | columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 |
| | | } |
| | | |
| | | //if (ds.Tables[0].Rows.Count != 0 || ds != null) |
| | | //{ |
| | |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | objJsonResult.list = columnNameList;//将columnNameList赋值给objJsonResult的list属性 |
| | | return objJsonResult; |
| | | //} |
| | | //else |
| | |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 删除功能 |
| | | /// <summary> |
| | | ///删除功能 |
| | |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //进行 会计期间 结账 的判断和控制 |
| | | string s = ""; |
| | | int sYear = 0; |
| | | int sPeriod = 0; |
| | | DateTime HDate = DateTime.Now; |
| | | if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) |
| | | { |
| | | objJsonResult.Message = s; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | oCN.BeginTran(); |
| | | |
| | | var ds = oCN.RunProcReturn("select * from Xs_SeOutStockBackBillMain where HInterID=" + HInterID, "Xs_SeOutStockBackBillMain"); |
| | | //删除前控制 |
| | | DataSet BeforeDs = oCN.RunProcReturn("Exec h_p_Xs_SeOutStockBackBill_BeforeDelCtrl " + HInterID.ToString() + ",'" + user + "'", "h_p_Xs_SeOutStockBackBill_BeforeDelCtrl"); |
| | | if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "删除前判断失败!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | if (DBUtility.ClsPub.isLong(BeforeDs.Tables[0].Rows[0]["HBack"]) == 1) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(BeforeDs.Tables[0].Rows[0]["HRemark"]); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | oCN.RunProc("Delete From Xs_SeOutStockBackBillMain where HInterID = " + HInterID); |
| | | oCN.RunProc("Delete From Xs_SeOutStockBackBillSub where HInterID = " + HInterID); |
| | | |
| | | //删除后控制 |
| | | DataSet EndDs = oCN.RunProcReturn("Exec h_p_Xs_SeOutStockBackBill_AfterDelCtrl " + HInterID.ToString() + ",'" + ds.Tables[0].Rows[0]["HBillNo"].ToString() + "','" + user + "'", " h_p_Xs_SeOutStockBackBill_AfterDelCtrl"); |
| | | if (EndDs == null || EndDs.Tables.Count == 0 || EndDs.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "删除后判断失败!"; |
| | | objJsonResult.data = null; |
| | | oCN.RollBack(); |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | if (DBUtility.ClsPub.isLong(EndDs.Tables[0].Rows[0]["HBack"]) == 1) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "删除失败!" + DBUtility.ClsPub.isStrNull(EndDs.Tables[0].Rows[0]["HRemark"]); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | oCN.Commit(); |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region 退货通知单审核/反审核功能 |
| | | [Route("Xs_SeOutStockBackBill/CheckXs_SeOutStockBackBill")] |
| | | [HttpGet] |
| | | public object CheckXs_SeOutStockBackBill(string HInterID, int Type, string user) |
| | | { |
| | | try |
| | | { |
| | | //判断是否有删除权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Xs_SeOutStockBackBill_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; |
| | | } |
| | | |
| | | ClsPub.CurUserName = user; |
| | | |
| | | //进行 会计期间 结账 的判断和控制 |
| | | string s = ""; |
| | | int sYear = 0; |
| | | int sPeriod = 0; |
| | | DateTime HDate = DateTime.Now; |
| | | if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) |
| | | { |
| | | objJsonResult.Message = s; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | oCN.BeginTran();//开始事务 |
| | | |
| | | //Type 1 审核 2 反审核 |
| | | if (Type == 1) |
| | | { |
| | | //审核前控制 |
| | | DataSet BeforeDs = oCN.RunProcReturn("Exec h_p_Xs_SeOutStockBackBill_BeforeCheckCtrl " + HInterID.ToString() + ",'" + user + "'", "h_p_Xs_SeOutStockBackBill_BeforeCheckCtrl"); |
| | | if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "审核前判断失败!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | if (DBUtility.ClsPub.isLong(BeforeDs.Tables[0].Rows[0]["HBack"]) == 1) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "审核失败!" + DBUtility.ClsPub.isStrNull(BeforeDs.Tables[0].Rows[0]["HRemark"]); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | if (!BillOld.CheckBill(int.Parse(HInterID), BillOld.omodel.HBillNo, "h_p_Xs_SeOutStockBackBill_AfterCheckCtrl", user, ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "审核失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | |
| | | //反审核前控制 |
| | | DataSet BeforeDs = oCN.RunProcReturn("Exec h_p_Xs_SeOutStockBackBill_BeforeUnCheckCtrl " + HInterID.ToString() + ",'" + user + "'", "h_p_Xs_SeOutStockBackBill_BeforeUnCheckCtrl"); |
| | | if (BeforeDs == null || BeforeDs.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "反审核前判断失败!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | if (DBUtility.ClsPub.isLong(BeforeDs.Tables[0].Rows[0]["HBack"]) == 1) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "反审核失败!" + DBUtility.ClsPub.isStrNull(BeforeDs.Tables[0].Rows[0]["HRemark"]); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | if (BillOld.AbandonCheck(int.Parse(HInterID), BillOld.omodel.HBillNo, "h_p_Xs_SeOutStockBackBill_AfterUnCheckCtrl", user, ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | 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("Xs_SeOutStockBackBill/CloseXs_SeOutStockBackBill")] |
| | | [HttpGet] |
| | | public object CloseXs_SeOutStockBackBill(string HInterID, int Type, string user) |
| | | { |
| | | try |
| | | { |
| | | //判断是否有删除权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Xs_SeOutStockBackBill_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; |
| | | |
| | | oCN.BeginTran();//开始事务 |
| | | |
| | | //Type 1 关闭 2 反关闭 |
| | | if (Type == 1) |
| | | { |
| | | if (!BillOld.CloseBill(int.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "关闭失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (!BillOld.CancelClose(int.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("Xs_SeOutStockBackBill/CancellXs_SeOutStockBackBill")] |
| | | [HttpGet] |
| | | public object CancellXs_SeOutStockBackBill(string HInterID, int Type, string user) |
| | | { |
| | | try |
| | | { |
| | | //判断是否有删除权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Xs_SeOutStockBackBill_Delete", 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; |
| | | |
| | | oCN.BeginTran();//开始事务 |
| | | |
| | | //Type 1 作废 2 反作废 |
| | | if (Type == 1) |
| | | { |
| | | if (!BillOld.Cancelltion(int.Parse(HInterID), ref ClsPub.sExeReturnInfo)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "作废失败!原因:" + ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (!BillOld.AbandonCancelltion(int.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> |
| | | /// <param name="msg"></param> |
| | | /// <returns></returns> |
| | | [Route("Xs_SeOutStockBackBill/SaveXs_SeOutStockBackBillList")] |
| | | [HttpPost] |
| | | public object SaveXs_SeOutStockBackBillList([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 user = sArray[2].ToString(); |
| | | string OperationType = sArray[3].ToString(); |
| | | |
| | | string UserName = ""; |
| | | ListModels oListModels = new ListModels(); |
| | | try |
| | | { |
| | | //判断权限 |
| | | if (!DBUtility.ClsPub.Security_Log("Xs_SeOutStockBackBill_Edit", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无保存权限"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | DAL.ClsXs_SeOutStockBackBillForLayUI oBill = new DAL.ClsXs_SeOutStockBackBillForLayUI(); |
| | | List<Model.ClsXs_SeOutStockBackBillMain> lsmain = new List<Model.ClsXs_SeOutStockBackBillMain>(); |
| | | msg2 = msg2.Replace("\\", ""); |
| | | msg2 = msg2.Replace("\n", ""); //\n |
| | | lsmain = oListModels.getSeOutStockBackBillMainByJson(msg2); |
| | | foreach (Model.ClsXs_SeOutStockBackBillMain oItem in lsmain) |
| | | { |
| | | //oItem.HMaker = ""; |
| | | UserName = oItem.HMaker; |
| | | oItem.HMakeDate = DBUtility.ClsPub.isStrNull(DateTime.Now.ToString("yyyy-MM-dd")); |
| | | oItem.HYear = DBUtility.ClsPub.isLong(DateTime.Now.Year); |
| | | oItem.HDate = DBUtility.ClsPub.isDate(DateTime.Now.ToString("yyyy-MM-dd")); |
| | | oItem.HBillType = "1403"; |
| | | oItem.HBillSubType = "1403"; |
| | | oItem.HBillStatus = 0; |
| | | oItem.HPeriod = 0; |
| | | oItem.HMaker = user; |
| | | oItem.HMainSourceInterID = oItem.HInterID; |
| | | |
| | | //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | 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.ClsXs_SeOutStockBackBillSub> ls = new List<Model.ClsXs_SeOutStockBackBillSub>(); |
| | | ls = oListModels.getSeOutStockBackBillSubByJson(msg3); |
| | | int i = 0; |
| | | foreach (Model.ClsXs_SeOutStockBackBillSub oItemSub in ls) |
| | | { |
| | | i++; |
| | | oItemSub.HSourceEntryID = 0; |
| | | oItemSub.HSourceInterID = 0; |
| | | oItemSub.HEntryID = i; |
| | | // DBUtility.ClsPub.isDate(DateTime.Now); |
| | | oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); |
| | | oItemSub.HCloseType = false; |
| | | oItemSub.HSourceBillNo = ""; |
| | | oItemSub.HSourceBillType = ""; |
| | | oItemSub.HRelationQty = 0; |
| | | oItemSub.HRelationMoney = 0; |
| | | oItemSub.HCloseMan = ""; |
| | | //oItemSub.HRemark = ""; |
| | | oBill.DetailColl.Add(oItemSub); |
| | | |
| | | } |
| | | |
| | | //进行 会计期间 结账 的判断和控制 |
| | | string s = ""; |
| | | int sYear = 0; |
| | | int sPeriod = 0; |
| | | DateTime HDate = DateTime.Now; |
| | | if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) |
| | | { |
| | | objJsonResult.Message = s; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //保存 |
| | | //保存完毕后处理 |
| | | bool bResult; |
| | | if (Convert.ToInt32(OperationType) == 1) |
| | | { |
| | | // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | } |
| | | else |
| | | { |
| | | bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | } |
| | | 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 |
| | | |
| | | /// <summary> |
| | | /// 根据ID 查找记录 |
| | | ///参数:string sql。 |
| | | ///返回值:object。 |
| | | /// </summary> |
| | | [Route("Xs_SeOutStockBackBill/cx")] |
| | | [HttpGet] |
| | | public object cx(long HInterID) |
| | | { |
| | | try |
| | | { |
| | | ds = oCN.RunProcReturn("select * from h_v_IF_SeOutStockBackBillList where hmainid=" + HInterID, "h_v_IF_SellOutBillList"); |
| | | 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 = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | |
| | | #region [退货通知单同步插件] |
| | | [Route("Xs_SeOutStockBackBill/SaveXs_SeOutStockBackBillApi")] |
| | | [HttpPost] |
| | | public object SaveXs_SeOutStockBackBillApi([FromBody] JObject sMainSub) |
| | | { |
| | | try |
| | | { |
| | | LogService.Write("退货通知单同步:" + sMainSub.ToString()); |
| | | var model = sMainSub["model"].ToString(); |
| | | var entry = sMainSub["model"]["HENTRY"].ToString(); |
| | | |
| | | model = "[" + model.ToString() + "]"; |
| | | List<Model.ClsXs_SeOutStockBackBillMain> mainList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsXs_SeOutStockBackBillMain>>(model); |
| | | List<Model.ClsXs_SeOutStockBackBillSub> subList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsXs_SeOutStockBackBillSub>>(entry); |
| | | string sql = string.Empty; |
| | | |
| | | oCN.BeginTran(); |
| | | sql = $"delete Xs_SeOutStockBackBillMain where HinterID = {mainList[0].HInterID}"; |
| | | oCN.RunProc(sql); |
| | | sql = $"delete Xs_SeOutStockBackbillSub where HinterID = {mainList[0].HInterID}"; |
| | | oCN.RunProc(sql); |
| | | //主表 |
| | | sql = "insert into Xs_SeOutStockBackBillMain " + |
| | | "(HInterID,HYear,HPeriod,HBillType,HBillSubType,HDate," + |
| | | "HBillNo,HBillStatus,HCusID,HManagerID,HDeptID,HRemark," + |
| | | "HAddress,HSSID,HCurID,HWHID,HExRate,HEmpID,HExplanation,HInnerBillNo," + |
| | | "HSALEORGID,HDELIVERYORGID,HOWNERID,HOWNERTYPEID," + |
| | | "HMaker,HMakeDate,HChecker,HCheckDate," + |
| | | "HUpDater,HUpDateDate,HDeleteMan,HDeleteDate,HERPInterID,HERPBillType," + |
| | | "HSETTLECUSID,HPAYCUSID,HRECEIVECUSID,HSALEGROUPID,HHEADLOCID,HRECCONTACTID," + |
| | | "HRETURNREASON,HRETDEPTID,HDESCRIPTION,HBUSINESSTYPE" + |
| | | ") values (" +mainList[0].HInterID + ", " + mainList[0].HYear + ", " + mainList[0].HPeriod + ", '" + mainList[0].HBillType + "', '" + mainList[0].HBillSubType + "', '" + mainList[0].HDate + "', " + |
| | | "'" + mainList[0].HBillNo + "', " + mainList[0].HBillStatus + ", " + mainList[0].HCusID + ", " + mainList[0].HManagerID + ", " + mainList[0].HDeptID + ", '" + mainList[0].HRemark + "', " + |
| | | "'" + mainList[0].HAddress + "', " + mainList[0].HSSID + ", " + mainList[0].HCurID + ", " + mainList[0].HWHID + ", " + mainList[0].HExRate + ", " + mainList[0].HEmpID + ", '" + mainList[0].HExplanation + "', '" + mainList[0].HInnerBillNo + "'," + |
| | | " " + mainList[0].HSALEORGID + ", " + mainList[0].HDELIVERYORGID + ", " + mainList[0].HOWNERID + ", '" + mainList[0].HOWNERTYPEID + "', " + |
| | | "'" + mainList[0].HMaker + "', '" + mainList[0].HMakeDate + "', '" + mainList[0].HChecker + "', '" + mainList[0].HCheckDate + "', " + |
| | | "'" + mainList[0].HUpDater + "', '" + mainList[0].HUpDateDate + "', '" + mainList[0].HDeleteMan + "', '" + mainList[0].HDeleteDate + "', " +mainList[0].HERPInterID + ", '" + mainList[0].HERPBillType + "', " + |
| | | "" + mainList[0].HSETTLECUSID + ", " + mainList[0].HPAYCUSID + ", " + mainList[0].HRECEIVECUSID + ", " + mainList[0].HSALEGROUPID + ", " + mainList[0].HHEADLOCID + ", " + mainList[0].HRECCONTACTID + ", " + |
| | | "'" + mainList[0].HRETURNREASON + "', " + mainList[0].HRETDEPTID + ", '" + mainList[0].HDESCRIPTION + "', '" + mainList[0].HBUSINESSTYPE + "')"; |
| | | LogService.Write("退货通知单主表同步:" + sql); |
| | | oCN.RunProc(sql); |
| | | //保存子表 |
| | | foreach (var oSub in subList) |
| | | { |
| | | sql = $@"insert into Xs_SeOutStockBackbillSub |
| | | (HInterID,HEntryID,HMaterID,HUnitID,HQty,HPrice, |
| | | HMoney,HTaxMoney,HTaxPrice,HWHID,HRemark, |
| | | HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HSeOrderInterID,HSeOrderEntryID,HSeORderBillNo, |
| | | HOWNERID,HOWNERTYPEID,HSETTLEORGID, |
| | | HRelationQty,HAuxPropID,HBatchNO,HMTONo,HERPInterID,HERPEntryID, |
| | | HSOBILLTYPEID,HRMTYPE,HSTOCKUNITID,HBASEUNITID,HDELIVERYDATE,HDESCRIPTION, |
| | | HMAPID,HPARENTMATID,HISRETURNCHECK,HROWTYPE,HROWID,HPARENTROWID, |
| | | HTAXCOMBINATION,HPRICEUNITID,HTaxRate,HPRICECOEFFICIENT,HSYSPRICE,HLIMITDOWNPRICE, |
| | | HDISCOUNTRATE,HISFREE,HSETTLETYPEID,HCHAGECONDITION,HSETTLECURRID, |
| | | HLOCALCURRID,HEXCHANGETYPEID,HISINCLUDEDTAX,HISPRICEEXCLUDETAX, |
| | | HTAXRATEID,HTaxRate_TAX,HTAXAMOUNT_TAX,HCOSTPERCENT,HCOSTAMOUNT, |
| | | HVAT,HSELLERWITHHOLDING,HBUYERWITHHOLDING, |
| | | HEXPUNIT,HEXPPERIOD,HProduceDate,HExpiryDate |
| | | ) values ('{oSub.HInterID}', '{oSub.HEntryID}', '{oSub.HMaterID}', '{oSub.HUnitID}', '{oSub.HQty}', '{oSub.HPrice}', |
| | | '{oSub.HMoney}', '{oSub.HTaxMoney}', '{oSub.HTaxPrice}', '{oSub.HWHID}', '{oSub.HRemark}', |
| | | '{oSub.HSourceInterID}', '{oSub.HSourceEntryID}', '{oSub.HSourceBillNo}', '{oSub.HSourceBillType}', '{oSub.HSeOrderInterID}', '{oSub.HSeOrderEntryID}', '{oSub.HSeOrderBillNo}', |
| | | '{oSub.HOWNERID}', '{oSub.HOWNERTYPEID}', '{oSub.HSETTLEORGID}', |
| | | '{oSub.HRelationQty}', '{oSub.HAuxPropID}', '{oSub.HBatchNO}', '{oSub.HMTONo}', '{oSub.HERPInterID}', '{oSub.HERPEntryID}', |
| | | '{oSub.HSOBILLTYPEID}', '{oSub.HRMTYPE}', '{oSub.HSTOCKUNITID}', '{oSub.HBASEUNITID}', '{oSub.HDELIVERYDATE}', '{oSub.HDESCRIPTION}', |
| | | '{oSub.HMAPID}', '{oSub.HPARENTMATID}', '{oSub.HISRETURNCHECK}', '{oSub.HROWTYPE}', '{oSub.HROWID}', '{oSub.HPARENTROWID}', |
| | | '{oSub.HTAXCOMBINATION}', '{oSub.HPRICEUNITID}', '{oSub.HTaxRate}', '{oSub.HPRICECOEFFICIENT}', '{oSub.HSYSPRICE}', '{oSub.HLIMITDOWNPRICE}', |
| | | '{oSub.HDISCOUNTRATE}', '{oSub.HISFREE}', '{oSub.HSETTLETYPEID}', '{oSub.HCHAGECONDITION}', '{oSub.HSETTLECURRID}', |
| | | '{oSub.HLOCALCURRID}', '{oSub.HEXCHANGETYPEID}', '{oSub.HISINCLUDEDTAX}', '{oSub.HISPRICEEXCLUDETAX}', |
| | | '{oSub.HTAXRATEID}', '{oSub.HTaxRate_TAX}', '{oSub.HTAXAMOUNT_TAX}', '{oSub.HCOSTPERCENT}', '{oSub.HCOSTAMOUNT}', |
| | | '{oSub.HVAT}', '{oSub.HSELLERWITHHOLDING}', '{oSub.HBUYERWITHHOLDING}', |
| | | '{oSub.HEXPUNIT}', '{oSub.HEXPPERIOD}', '{oSub.HProduceDate}', '{oSub.HExpiryDate}')"; |
| | | LogService.Write("退货通知单子表同步:" + sql); |
| | | oCN.RunProc(sql); |
| | | } |
| | | oCN.Commit(); |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "单据保存成功!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | LogService.Write("退货通知单同步异常,保存方法执行完成异常:" + e.Message.ToString()); |
| | | |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "保存失败!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | } |
| | | } |