ration.ts 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  1. /* eslint-disable camelcase */
  2. import {
  3. prefix,
  4. fromType,
  5. gljCreateType,
  6. createLocation,
  7. BRType,
  8. } from './base';
  9. import { IBookmark } from './bill';
  10. import { GljType, MaterialType } from './glj';
  11. import { IQuantityDetail } from './quantityDetail';
  12. // 标准定额库
  13. export interface IStdRationLib {
  14. dispName: string;
  15. compilationId: string;
  16. compilationName: string;
  17. gljLib: number;
  18. ID: number;
  19. }
  20. export interface IStdRationChapter {
  21. rationRepId: number; // 标准库的属性
  22. ID: string; // 补充库的直接用新结构,所以有两种类型
  23. parentID: string;
  24. seq: number;
  25. name: string;
  26. explanation?: string; // 说明
  27. ruleText?: string; // 计算规则,
  28. jobContentSituation?: string; // 工作内容适用情况,ALL适用本项全部定额,PARTIAL适用本项部分定额
  29. annotationSituation?: string; // 附注适用情况,ALL适用本项全部定额,PARTIAL适用本项部分定额
  30. }
  31. export interface ICptRationChapter {
  32. name: string;
  33. ID: string;
  34. seq: number;
  35. parentID: string;
  36. // 以下预留数据,以后开放可用
  37. explanation?: string; // 说明
  38. ruleText?: string; // 计算规则,
  39. jobContentSituation?: string; // 工作内容适用情况,ALL适用本项全部定额,PARTIAL适用本项部分定额
  40. annotationSituation?: string; // 附注适用情况,ALL适用本项全部定额,PARTIAL适用本项部分定额
  41. }
  42. export interface IBaseRationGljRef {
  43. consumeAmt: number;
  44. proportion?: number; // 配合比,暂时无需使用,默认0
  45. type?: fromType; // 可能有数据没有
  46. }
  47. export interface IStdRationGljRef extends IBaseRationGljRef {
  48. gljId: number; // 原std库已经是这样,不能改成ID
  49. }
  50. export interface ICptRationGljRef extends IBaseRationGljRef {
  51. gljId: string; // 原std库已经是这样,不能改成ID
  52. }
  53. export interface IStdRationAss {
  54. name: string;
  55. assistCode: string;
  56. stdValue: string;
  57. stepValue: string;
  58. decimal: number;
  59. carryBit: string;
  60. minValue: string;
  61. maxValue: string;
  62. paramName: string; // 参数名称
  63. param: string; // 参数
  64. thirdRationCode: string; // 第三定额
  65. }
  66. export interface IStdRationInstall {
  67. feeItemId: string; // 原std库已经是这样,不能改成ID
  68. sectionId: string; // 原std库已经是这样,不能改成ID
  69. }
  70. export interface IStdRationTemp {
  71. rationID: number;
  72. type: string;
  73. billsLocation: string;
  74. }
  75. export interface ICoeList {
  76. ID: number;
  77. no: number;
  78. }
  79. export enum CoeType {
  80. RATION = '定额',
  81. LABOUR = '人工',
  82. MATERIAL = '材料',
  83. MACHINE = '机械',
  84. TOOL = '施工机具',
  85. MAIN = '主材',
  86. EQUIPMENT = '设备',
  87. SINGLE = '单个工料机',
  88. REPLACE = '替换人材机',
  89. SELECT = '所选人材机',
  90. }
  91. export interface IStdCoe {
  92. coeType: CoeType; // 系数类型,指作用范围:
  93. // 单个(如:111量0.001)、人工类、材料类、机械类、全部(如:定额×0.925)。
  94. gljID?: number; // 要调整的工料机ID(当coeType=0时有效)
  95. operator: string; // 运算符(*、+、-、=)
  96. amount: string; // 调整的量
  97. gljCode: string;
  98. gljName?: string;
  99. replaceCode?: string;
  100. replaceName?: string;
  101. }
  102. export interface IBaseCoeItem {
  103. ID: number;
  104. serialNo?: number; // 编号
  105. name: string; // 名称
  106. content?: string; // 说明
  107. coes: IStdCoe[];
  108. }
  109. export interface IOptionList {
  110. text: string;
  111. value: string;
  112. }
  113. export interface ICptCoeItem extends IBaseCoeItem {
  114. userID: string;
  115. compilationID: string;
  116. }
  117. export interface IStdCoeItem extends IBaseCoeItem {
  118. libID: number; // 所属定额定ID
  119. original_code?: string; // 原人材机编码
  120. option_codes?: string; // 可选人材机编码
  121. option_list?: IOptionList[]; // 下拉列表选项
  122. }
  123. export interface IRationCoe {
  124. ID: string;
  125. stdID?: number; // 库里的ID
  126. name: string;
  127. content?: string;
  128. originalCode?: string;
  129. optionList?: IOptionList[];
  130. optionCodes?: string; // 可选人材机编码
  131. selectCode?: string; // 选中的人材机编码
  132. isAdjust: boolean; // 默认 false
  133. coes: IStdCoe[];
  134. }
  135. export interface IBaseRation {
  136. code: string;
  137. name: string;
  138. unit: string;
  139. basePrice: number;
  140. labourPrice: number;
  141. materialPrice: number;
  142. machinePrice: number;
  143. caption: string;
  144. feeType: number;
  145. jobContent: string;
  146. annotation: string;
  147. manageFeeRate: string; // 管理费费率
  148. rationCoeList: ICoeList[];
  149. rationAssList: IStdRationAss[];
  150. rationInstList: IStdRationInstall[];
  151. rationTemplateList: IStdRationTemp[];
  152. fromType?: fromType; // 单条查找结果时用到
  153. }
  154. export interface IStdRation extends IBaseRation {
  155. ID: number;
  156. rationRepId: number;
  157. sectionId: number;
  158. rationGljList: IStdRationGljRef[];
  159. chapter?: IStdRationChapter;
  160. }
  161. export interface ICptRation extends IBaseRation {
  162. userID: string;
  163. compilationID: string;
  164. ID: string;
  165. sectionId: string;
  166. rationGljList: ICptRationGljRef[];
  167. chapter?: ICptRationChapter;
  168. }
  169. export interface IStdComponent {
  170. ID: number;
  171. consumeAmt: number;
  172. consumeAmtProperty: any; // 多消耗量的情况
  173. }
  174. export interface ICptComponent {
  175. ID: string; // 补充的ID改成了UUID ,标准的不变,但是这里
  176. consumeAmt: number;
  177. consumeAmtProperty: any; // 多消耗量的情况
  178. from: fromType;
  179. }
  180. export interface IBaseRationGlj {
  181. code: string;
  182. name: string;
  183. specs?: string;
  184. basePrice: number;
  185. priceProperty: any; // 多单价的情况
  186. gljClass: number;
  187. type: number; // 这个要和项目工料机等统一,所以在查找项目工料机的时候转一下,
  188. gljType: number;
  189. model: number; // 机型
  190. shortName: string;
  191. unit: string;
  192. adjCoe: number;
  193. materialType: MaterialType; // 三材类别
  194. materialCoe: number; // 三材系数
  195. // 经济指标数据
  196. materialIndexType: string; // 工料指标类别
  197. materialIndexUnit: string; // 工料指标单位
  198. materialIndexCoe: number; // 单位转换系数
  199. taxRate: string; // 税率
  200. }
  201. // 保存到项目下的定额工料机
  202. export interface IRationGlj {
  203. ID: string;
  204. gljID?: string;
  205. repositoryID?: number;
  206. name: string;
  207. code: string;
  208. originalCode: string; // 原始的编码 不带 “-”的
  209. beforeReplaceCode?: string; // 替换工料机后记录原来的工料机编码,要做判断 有可能带“-”
  210. specs?: string;
  211. unit: string;
  212. type: GljType;
  213. model?: number; // 机型
  214. adjCoe?: number; // 调整系数ID
  215. quantity: number;
  216. customQuantity?: number;
  217. rationQuantity?: number;
  218. tenderQuantity?: number; // 调整后消耗量
  219. marketPrice?: number; // 市场价 - 不保存至数据库
  220. basePrice?: number; // 定额价 - 不保存至数据库
  221. createType: gljCreateType; // normal、add、replace 正常、添加工料机、替换工料机
  222. from: fromType; // std, cpt 来自标准工料机库、补充工料机库
  223. }
  224. export interface IStdRationGlj extends IBaseRationGlj {
  225. ID: number;
  226. repositoryId: number;
  227. components: IStdComponent[];
  228. }
  229. export interface ICptRationGlj extends IBaseRationGlj {
  230. ID: string;
  231. userID: string;
  232. compilationID: string;
  233. components: ICptComponent[];
  234. }
  235. export interface IGljQtyCoe {
  236. labour: number; // 人工
  237. material: number; // 材料
  238. machine: number; // 机械
  239. main: number; // 主材
  240. equipment: number; // 设备
  241. }
  242. // 实际保存到项目中的辅助定额数据
  243. export interface IRationAss extends IStdRationAss {
  244. ID: string;
  245. actualValue?: number;
  246. isAdjust: boolean; // 是否调整
  247. groupList?: IRationAss[]; // 当有分组的时候用这个
  248. // 这里辅助定额直接保存工料机的数据,用的时候不用再获取
  249. rationGljList?: IRationGlj[]; // 定额工料机
  250. }
  251. export interface ITemplateItem {
  252. ID: string;
  253. code: string;
  254. name: string;
  255. type: string;
  256. defaultLocation: string; // 记录默认给定的清单编号,恢复原始数据时用(目前复制整块)
  257. billsLocation: string; // 这个是清单编号
  258. fxID: string; // 这个是分项对应的ID
  259. unit: string;
  260. quantity: number;
  261. coe: number;
  262. billID?: string; // 记取位置对应的清单ID
  263. }
  264. export interface IRationTemplate {
  265. createLocation: createLocation; // 提取位置
  266. templateList: ITemplateItem[];
  267. }
  268. // 定额安装增加费
  269. export interface IRationInstall {
  270. ID: string;
  271. sectionID: string; // 分册章节id
  272. feeItemID: string;
  273. ruleID: string;
  274. itemName: string;
  275. sectionName: string;
  276. unifiedSetting: boolean; // 0:false 1:true 按统一设置
  277. }
  278. export interface IThirdRation {
  279. ration: IStdRation;
  280. rationGljList: IRationGlj[];
  281. }
  282. export interface IRation {
  283. ID: string;
  284. parentID: string;
  285. seq: number;
  286. kind: BRType;
  287. code?: string;
  288. name?: string;
  289. unit?: string;
  290. type?: GljType; // 子类型:1人工、201材料、301机械、4主材、5设备
  291. quantity?: number;
  292. contain?: number; // 含量
  293. quantityEXP?: string; // 工程量表达式
  294. programID?: number;
  295. fees?: any; // 费用字段
  296. gljQtyCoe?: IGljQtyCoe; // 工料机消耗量调整系数字段
  297. rationQtyCoe?: number; // 子目工程量调整系数
  298. tenderQuantity?: string; // 调整后工程量
  299. noAdjustPrice?: boolean; // { type: boolean; default: false }; // 不调价
  300. targetUnitFee?: string; // 目标单价
  301. targetTotalFee?: string; // 目标合价
  302. from?: fromType; // { type: string; default: 'std' }; // std, cpt 来自标准、补充
  303. isSubcontract?: boolean; // 是否分包
  304. installationKey?: string; // 用来记录安装增加费的关联字段
  305. // 定额特有属性:
  306. stdID?: string; // 来自的标准定额ID
  307. repositoryID?: number; // 定额库ID
  308. maskName?: string;
  309. caption?: string;
  310. evaluationProject?: boolean; // { type: boolean; default: false }; // 1 true 0 false 估价项目
  311. adjustState?: string;
  312. comments?: string; // 说明
  313. content?: string; // 工作内容
  314. annotation?: string; // 附注
  315. ruleText?: string; // 计算规则
  316. prefix?: prefix; // { type: string; default: '' }; // 定额是补充、借用时用 补 借
  317. referenceRationID?: string; // 如果是通过模板关联子目生成的定额,这里记录对应的主定额ID
  318. jobContentText?: string; // 工作内容 (选择自清单)
  319. manageFeeRate?: string; // 管理费率
  320. // 是否记取面积增加费
  321. areaIncreaseFee?: boolean | null; // { type: Schema.Types.Mixed; default: false }; // true 是,false否,null 不确定,三个状态
  322. // 工料机特有属性
  323. gljID?: string; // 工料机在库中ID
  324. originalCode?: string; // 原始编码
  325. specs?: string; // 规格型号
  326. customQuantity?: string; // 自定义消耗
  327. model?: number; // 机型
  328. adjCoe?: number;
  329. remark?: string; // 备注
  330. bookmarkBackground?: string; // 书签背景色
  331. bookmarkAnnotation?: string; // 批注
  332. overHeight?: string; // 超高降效
  333. referenceRationList?: any; // { type: Array; default: [] }; // 关联的定额ID列表,如超高子目关联的定额ID列表
  334. // 定额子项
  335. rationGljList?: IRationGlj[]; // 定额工料机
  336. rationAssList?: IRationAss[]; // 辅助定额
  337. thirdRation?: IThirdRation; // 第三定额
  338. quantityDetails?: IQuantityDetail[]; // 工程量明细 -- 原先保存在另外的表中
  339. rationCoeList?: IRationCoe[]; // 定额调整系数
  340. rationTemplate?: IRationTemplate; // 定额模板
  341. rationInstallList?: IRationInstall[]; // 定额安装增加
  342. bookmarks?: IBookmark[];
  343. }
  344. export interface IRations {
  345. projectID: string;
  346. index: number;
  347. rations: IRation[];
  348. }
  349. export interface IStdRationsAndGljs {
  350. rations: (IStdRation | ICptRation)[];
  351. rationGljs: (IStdRationGlj | ICptRationGlj)[];
  352. }
  353. export enum RationListType {
  354. ASS = 'rationAssList',
  355. COE = 'rationCoeList',
  356. GLJ = 'rationGljList',
  357. }