public void DoGoodsReject(AscmWmsBackInvoiceMain ascmWmsBackInvoiceMain, List<AscmWmsBackInvoiceLink> listWmsBackInvoiceLink, string userId, AscmMesInteractiveLog ascmMesInteractiveLog) { try { OracleParameter[] goodsRejectParams = GetGoodsRejectParams(ascmWmsBackInvoiceMain, listWmsBackInvoiceLink, userId); ISession session = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession(); OracleCommand command = (OracleCommand)session.Connection.CreateCommand(); command.CommandType = CommandType.StoredProcedure; command.CommandText = "cux_mes_ascm_interface_pkg.ascm_do_goods_reject"; Array.ForEach<OracleParameter>(goodsRejectParams, P => command.Parameters.Add(P)); command.ExecuteNonQuery(); ascmMesInteractiveLog.returnCode = goodsRejectParams[goodsRejectParams.Length - 2].Value.ToString(); ascmMesInteractiveLog.returnMessage = goodsRejectParams[goodsRejectParams.Length - 1].Value.ToString(); if (ascmWmsBackInvoiceMain != null) { ascmWmsBackInvoiceMain.returnCode = ascmMesInteractiveLog.returnCode; ascmWmsBackInvoiceMain.returnMessage = ascmMesInteractiveLog.returnMessage; ascmWmsBackInvoiceMain.uploadTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); } } catch (Exception ex) { throw ex; } }
public void Delete(AscmWmsBackInvoiceMain ascmWmsBackInvoiceMain) { try { YnDaoHelper.GetInstance().nHibernateHelper.Delete<AscmWmsBackInvoiceMain>(ascmWmsBackInvoiceMain); } catch (Exception ex) { YnBaseClass2.Helper.LogHelper.GetLog().Error("删除失败(Delete AscmWmsBackInvoiceMain)", ex); throw ex; } }
public void Update(AscmWmsBackInvoiceMain ascmWmsBackInvoiceMain) { try { using (ITransaction tx = YnDaoHelper.GetInstance().nHibernateHelper.GetCurrentSession().BeginTransaction()) { try { YnDaoHelper.GetInstance().nHibernateHelper.Update<AscmWmsBackInvoiceMain>(ascmWmsBackInvoiceMain); tx.Commit();//正确执行提交 } catch (Exception ex) { tx.Rollback();//回滚 YnBaseClass2.Helper.LogHelper.GetLog().Error("修改失败(Update AscmWmsBackInvoiceMain)", ex); throw ex; } } } catch (Exception ex) { YnBaseClass2.Helper.LogHelper.GetLog().Error("修改失败(Save AscmWmsBackInvoiceMain)", ex); throw ex; } }
public OracleParameter[] GetGoodsRejectParams(AscmWmsBackInvoiceMain ascmWmsBackInvoiceMain, List<AscmWmsBackInvoiceLink> listWmsBackInvoiceLink, string userId) { //注意MES存储过程中要求字符串数组长度一致,并且一一对应 string[] batchDocNumbers = listWmsBackInvoiceLink.Select(P => P.barCode).ToArray(); string[] labelIds = new string[batchDocNumbers.Length]; string[] materialIds = listWmsBackInvoiceLink.Select(P => P.materialId.ToString()).ToArray(); string[] warehouseIds = listWmsBackInvoiceLink.Select(P => P.warehouseId).ToArray(); string[] locIds = new string[batchDocNumbers.Length]; string[] quantities = listWmsBackInvoiceLink.Select(P => P.rejectQuantity.ToString()).ToArray(); string[] accountStatuss = new string[batchDocNumbers.Length]; //为数组元素指定默认值 for (int i = 0; i < batchDocNumbers.Length; i++) { labelIds[i] = ""; locIds[i] = ""; accountStatuss[i] = ascmWmsBackInvoiceMain.accountStatus; } return new OracleParameter[] { //库存组织 new OracleParameter{ ParameterName = "i_org_id", OracleDbType = OracleDbType.Int32, Value = orgId, Direction = ParameterDirection.Input }, //MES闭环退货单号 new OracleParameter{ ParameterName = "i_rejectno", OracleDbType = OracleDbType.Varchar2, Size = 80, Value = ascmWmsBackInvoiceMain.docNumber, Direction = ParameterDirection.Input }, //手工退货单号 new OracleParameter{ ParameterName = "i_manuno", OracleDbType = OracleDbType.Varchar2, Size = 80, Value = ascmWmsBackInvoiceMain.manualDocNumber, Direction = ParameterDirection.Input }, //系统收据号 new OracleParameter{ ParameterName = "i_systemno", OracleDbType = OracleDbType.Varchar2, Size = 80, Value = null, Direction = ParameterDirection.Input }, //制单人 new OracleParameter{ ParameterName = "i_maker", OracleDbType = OracleDbType.Varchar2, Size = 80, Value = ascmWmsBackInvoiceMain.createUser, Direction = ParameterDirection.Input }, //退货原因,ERP事务原因id new OracleParameter{ ParameterName = "i_resion_id", OracleDbType = OracleDbType.Varchar2, Size = 80, Value = ascmWmsBackInvoiceMain.reasonId, Direction = ParameterDirection.Input }, //送货单备注 new OracleParameter{ ParameterName = "i_memo", OracleDbType = OracleDbType.Varchar2, Size = 240, Value = ascmWmsBackInvoiceMain.memo, Direction = ParameterDirection.Input }, //标签号(字符串数组) new OracleParameter{ ParameterName = "i_labelid", OracleDbType = OracleDbType.Varchar2, Value = labelIds, Direction = ParameterDirection.Input, CollectionType = OracleCollectionType.PLSQLAssociativeArray }, //送货批单条码号(字符串数组) new OracleParameter{ ParameterName = "i_deliveryno", OracleDbType = OracleDbType.Varchar2, Value = batchDocNumbers, Direction = ParameterDirection.Input, CollectionType = OracleCollectionType.PLSQLAssociativeArray }, //物料编码(字符串数组) new OracleParameter{ ParameterName = "i_itemid", OracleDbType = OracleDbType.Varchar2, Value = materialIds, Direction = ParameterDirection.Input, CollectionType = OracleCollectionType.PLSQLAssociativeArray }, //仓库(字符串数组),不可为空 new OracleParameter{ ParameterName = "i_invcode", OracleDbType = OracleDbType.Varchar2, Value = warehouseIds, Direction = ParameterDirection.Input, CollectionType = OracleCollectionType.PLSQLAssociativeArray }, //位置(字符串数组) new OracleParameter{ ParameterName = "i_locid", OracleDbType = OracleDbType.Varchar2, Value = locIds, Direction = ParameterDirection.Input, CollectionType = OracleCollectionType.PLSQLAssociativeArray }, //退货数量(字符串数组) new OracleParameter{ ParameterName = "i_quantity", OracleDbType = OracleDbType.Varchar2, Value = quantities, Direction = ParameterDirection.Input, CollectionType = OracleCollectionType.PLSQLAssociativeArray }, //账务状态(字符串数组) new OracleParameter{ ParameterName = "i_accountstatus", OracleDbType = OracleDbType.Varchar2, Value = accountStatuss, Direction = ParameterDirection.Input, CollectionType = OracleCollectionType.PLSQLAssociativeArray }, //用户名称 new OracleParameter{ ParameterName = "i_user_code", OracleDbType = OracleDbType.Varchar2, Size = 80, Value = userId, Direction = ParameterDirection.Input }, //返回参(值为0时表示成功) new OracleParameter{ ParameterName = "o_ret_code", OracleDbType = OracleDbType.Varchar2, Size = 4000, Direction = ParameterDirection.Output }, //返回参(错误信息) new OracleParameter{ ParameterName = "o_ret_msg", OracleDbType = OracleDbType.Varchar2, Size = 4000, Direction = ParameterDirection.Output } }; }