| | |
| | | using Newtonsoft.Json.Linq; |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Linq; |
| | | using NPOI.SS.Formula.Functions; |
| | | using Pub_Class; |
| | | using System; |
| | |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>();//定义声明变量 ,把通过 new List<object>()创建的 实例,赋值给变量 |
| | | if (sWhere == null || sWhere.Equals("")) |
| | | { |
| | | string sql = "select * from h_v_Kf_POStockInBillList order by hmainid desc"; |
| | |
| | | string sql = sql1 + sWhere+ " order by hmainid desc"; |
| | | ds = oCN.RunProcReturn(sql, "h_v_Kf_POStockInBillList"); |
| | | } |
| | | 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 |
| | |
| | | string HCloseMan = mainList[0].HCloseMan; |
| | | string HCloseDate = mainList[0].HCloseDate; |
| | | |
| | | //进行 会计期间 结账 的判断和控制 |
| | | string s = ""; |
| | | int sYear = 0; |
| | | int sPeriod = 0; |
| | | if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(HDate, ref sYear, ref sPeriod, ref s) == false) |
| | | { |
| | | objJsonResult.Message = s; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | ds = oCN.RunProcReturn("select * from h_v_Kf_POStockInBillList where hmainid=" + HInterID + " and 单据号='" + HBillNo + "'", "h_v_Kf_POStockInBillList"); |
| | | |
| | | if ((OperationType == 1 || OperationType == 2 || OperationType == 4) && ds.Tables[0].Rows.Count == 0)//新增 |
| | |
| | | ,HAddress,HSupID,HCurID,HWHID,HEmpID,HManagerID,HSecManagerID,HKeeperID,HDeptID,HExplanation,HRemark |
| | | ,HInnerBillNo,HSTOCKORGID,HOWNERID,HMaker,HMakeDate,HProjectID,HInvoiceBillNo) |
| | | values(" + HInterID + "," + DateTime.Now.Year + "," + DateTime.Now.Month + ",'" + 1201 + "','" + |
| | | HBillSubType + "','" + HDate + "','" + HBillNo + "','" + HBillStatus + "','" + HAddress + |
| | | 1201 + "','" + HDate + "','" + HBillNo + "','" + HBillStatus + "','" + HAddress + |
| | | "'," + HSupID + "," + HCurID + "," + HWHID + "," + HEmpID + "," + HManagerID + "," + |
| | | HSecManagerID + ","+ HKeeperID +"," + HDeptID + ",'" + HExplanation + "','" + HRemark |
| | | + "','" + HInnerBillNo + "'," + HSTOCKORGID + "," + HOWNERID + ",'" + HMaker + "',getdate(),"+ HProjectID + ",'"+ HInvoiceBillNo + "')"; |
| | |
| | | } |
| | | else if (OperationType == 3 || ds.Tables[0].Rows.Count != 0) |
| | | { //修改 |
| | | |
| | | DataSet dss; |
| | | dss = oCN.RunProcReturn("select * from h_v_Kf_POStockInBillList where hmainid=" + HInterID + " and 单据号='" + HBillNo + "'", "h_v_Kf_POStockInBillList"); |
| | | //判断是否可编辑 |
| | | if (dss.Tables[0].Rows[0]["审核人"].ToString() != "" && dss.Tables[0].Rows[0]["审核人"] != null) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "此单据已经被审核,不允许修改!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | if (dss.Tables[0].Rows[0]["状态"].ToString() != "创建") |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "此单据处于不可编辑状态,不允许修改!"; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | String sql = $@"update Kf_ICStockBillMain set " + |
| | | "HRemark='" + HRemark + "', HUpDater='" + HMaker + "', HUpDateDate=getdate()" + |
| | | ",HSupID=" + HSupID + ",HCurID=" + HCurID + ",HSecManagerID=" + HSecManagerID + ", HSTOCKORGID=" + HSTOCKORGID + ",HKeeperID=" + HKeeperID + ",HWHID = " + HWHID |
| | |
| | | + ",HAddress='" + HAddress + "',HInnerBillNo='" + HInnerBillNo + "',HProjectID="+ HProjectID + ",HInvoiceBillNo='"+ HInvoiceBillNo + "' where HInterID=" + HInterID; |
| | | |
| | | oCN.RunProc(sql); |
| | | |
| | | //采购入库单 编辑 撤销回填 采购订单 关联数量 |
| | | oCN.RunProc("exec h_p_Cg_UpDateRelation_POOrderToPOStockIn_Del " + HInterID); |
| | | |
| | | //采购入库单 编辑 撤销回填 收料通知单 关联数量 |
| | | oCN.RunProc("exec h_p_Cg_UpDateRelation_POInStockToPOStockIn_Del " + HInterID); |
| | | |
| | | //删除子表 |
| | | oCN.RunProc("delete from Kf_ICStockBillSub where HInterID='" + HInterID + "'"); |
| | | } |
| | |
| | | |
| | | //采购入库单新增回填收料通知单关联数量 |
| | | oCN.RunProc("exec h_p_Cg_UpDateRelation_POInStockToPOStockIn_Add " + HInterID); |
| | | |
| | | |
| | | |
| | | if (objJsonResult.code == "0") |
| | | { |
| | |
| | | } |
| | | //================================================================================== |
| | | |
| | | //进行 会计期间 结账 的判断和控制 |
| | | 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; |
| | | } |
| | | |
| | | string sReturn = ""; |
| | | oCN.BeginTran(); |
| | | |
| | | //采购入库单 删除 撤销回填 采购订单 关联数量 |
| | | oCN.RunProc("exec h_p_Cg_UpDateRelation_POOrderToPOStockIn_Del " + HInterID); |
| | | |
| | | //采购入库单 删除 撤销回填 收料通知单 关联数量 |
| | | oCN.RunProc("exec h_p_Cg_UpDateRelation_POInStockToPOStockIn_Del " + HInterID); |
| | | |
| | | oCN.RunProc("Delete From Kf_ICStockBillMain where HInterID = " + HInterID); |
| | | oCN.RunProc("Delete From Kf_ICStockBillSub where HInterID = " + HInterID); |
| | | oCN.Commit(); |
| | |
| | | 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; |
| | | } |
| | | |
| | | //进行需要进行的审核/反审核操作 |
| | | if (IsAudit == 0) //审核提交 |
| | |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //================================================================================== |
| | | |
| | | //================================================================================== |
| | | |
| | | //审核提交 |
| | | if (oBill.CheckBill(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Kf_POStockInBill_AfterCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | | { |
| | |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //========================================================= |
| | | |
| | | //========================================================= |
| | | |
| | | //反审核提交AbandonCheck |
| | | if (oBill.AbandonCheck(oBill.omodel.HInterID, oBill.omodel.HBillNo, "h_p_Kf_POStockInBill_AfterUnCheckCtrl", CurUserName, ref DBUtility.ClsPub.sExeReturnInfo) == true) |
| | | { |
| | |
| | | #endregion |
| | | |
| | | |
| | | #region 采购入库单 根据主内码与子内码获取采购入库单数据 |
| | | #region 采购入库单 根据主内码与子内码获取采购入库单数据 |
| | | [Route("Kf_POStockInBill/loadKf_POStockInBill_Push")] |
| | | [HttpGet] |
| | | public object loadKf_POStockInBill_Push(long HInterID, long HSubID) |