| | |
| | | string user = sArray[2].ToString(); |
| | | string OperationType = sArray[3].ToString(); |
| | | |
| | | string UserName = ""; |
| | | ListModels oListModels = new ListModels(); |
| | | try |
| | | { |
| | |
| | | lsmain = oListModels.getSellOutBillMainByJson(msg2); |
| | | foreach (Model.ClsKf_SellOutBillMain 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 = "1205"; |
| | | oItem.HBillSubType = "1205"; |
| | | oItem.HBillStatus = 0; |
| | | oItem.HPeriod = 0; |
| | | oItem.HMaker = user; |
| | | oItem.HMainSourceInterID = oItem.HInterID; |
| | | oItem.HUpDater = user; |
| | | |
| | | //oItem.HInterID = DBUtility.ClsPub.CreateBillID_SRMProd("1103", ref DBUtility.ClsPub.sExeReturnInfo); |
| | | if (DBUtility.ClsPub.isStrNull(oItem.HDate) == "") |
| | | { |
| | | objJsonResult.code = "0"; |
| | |
| | | msg3 = msg3.Substring(1, msg3.Length - 2); |
| | | msg3 = msg3.Replace("\\", ""); |
| | | msg3 = msg3.Replace("\n", ""); //\n |
| | | //msg2 = msg2.Replace("'", "’"); |
| | | List<Model.ClsKf_SellOutBillSub> ls = new List<Model.ClsKf_SellOutBillSub>(); |
| | | ls = oListModels.getSellOutBillSubByJson(msg3); |
| | | int i = 0; |
| | | foreach (Model.ClsKf_SellOutBillSub oItemSub in ls) |
| | | { |
| | | i++; |
| | | |
| | | oItemSub.HEntryID = i; |
| | | //oItemSub.HSourceEntryID = 0; |
| | | //oItemSub.HSourceInterID = 0; |
| | | //oItemSub.HSourceBillNo = ""; |
| | | //oItemSub.HSourceBillType = ""; |
| | | oItemSub.HRelationQty = 0; |
| | | oItemSub.HRelationMoney = 0; |
| | | |
| | | |
| | | // DBUtility.ClsPub.isDate(DateTime.Now); |
| | | oItemSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DateTime.Now); |
| | | oItemSub.HCloseType = false; |
| | | oItemSub.HCloseMan = ""; |
| | | //oItemSub.HRemark = ""; |
| | | oBill.DetailColl.Add(oItemSub); |
| | | |
| | | } |
| | | |
| | | //保存 |
| | | //保存完毕后处理 |
| | | bool bResult; |
| | | if (Convert.ToInt32(OperationType) == 1) |
| | | if (Convert.ToInt32(OperationType) == 1) //新增保存 |
| | | { |
| | | // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | } |
| | | else |
| | | 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; |
| | | } |
| | |
| | | { |
| | | try |
| | | { |
| | | ds = oCN.RunProcReturn("select * from h_v_IF_SellOutBillList where hmainid=" + HInterID, "h_v_IF_SellOutBillList"); |
| | | //ds = oCN.RunProcReturn("select * from h_v_IF_SellOutBillList where hmainid=" + HInterID, "h_v_IF_SellOutBillList"); |
| | | ds = oCN.RunProcReturn("select * from h_v_IF_SellOutBillList_EditInit where hmainid=" + HInterID, "h_v_IF_SellOutBillList_EditInit"); |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 销售出库 条码明细 |
| | | /// <summary> |
| | | /// </summary> |
| | | /// <param name="HInterID">单据ID</param> |
| | | /// <returns></returns> |
| | | [Route("Kf_SellOutBill/BarCodeNote")] |
| | | [HttpGet] |
| | | public object SellOutBill_BarCodeNote(int HInterID) |
| | | { |
| | | try |
| | | { |
| | | List<object> columnNameListSum = new List<object>(); |
| | | List<object> columnNameList0 = new List<object>(); |
| | | List<object> columnNameList1 = new List<object>(); |
| | | List<object> columnNameList2 = new List<object>(); |
| | | |
| | | string sql = "exec h_p_Kf_SellOutBillBarCodeNote " + HInterID; |
| | | ds = oCN.RunProcReturn(sql, "h_p_Kf_SellOutBillBarCodeNote"); |
| | | |
| | | //添加 基本信息 列名 |
| | | foreach (DataColumn col in ds.Tables[1].Columns) |
| | | { |
| | | Type dataType = col.DataType; |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; |
| | | columnNameList0.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 |
| | | } |
| | | |
| | | //添加 码单信息 列名 |
| | | foreach (DataColumn col in ds.Tables[2].Columns) |
| | | { |
| | | Type dataType = col.DataType; |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; |
| | | columnNameList1.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 |
| | | } |
| | | |
| | | //添加 条码明细 列名 |
| | | foreach (DataColumn col in ds.Tables[3].Columns) |
| | | { |
| | | Type dataType = col.DataType; |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; |
| | | columnNameList2.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 |
| | | } |
| | | |
| | | columnNameListSum.Add(columnNameList0); |
| | | columnNameListSum.Add(columnNameList1); |
| | | columnNameListSum.Add(columnNameList2); |
| | | |
| | | List<DataTable> tableList = new List<DataTable>(); |
| | | tableList.Add(ds.Tables[1]); |
| | | tableList.Add(ds.Tables[2]); |
| | | tableList.Add(ds.Tables[3]); |
| | | |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = tableList; |
| | | objJsonResult.list = columnNameListSum; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | } |
| | | } |